0

I have a number of rows in the table, which datetime column values contain both date and time. I need to remove time part from them. By another words, if value is 2006-08-10 01:00:00.000, it should be replaced with 2006-08-10 00:00:00.000.
Is it possible? Thanks in advance.

Sergey Metlov
  • 25,747
  • 28
  • 93
  • 153
  • possible duplicate of [Best approach to remove time part of datetime in SQL Server](http://stackoverflow.com/questions/1177449/best-approach-to-remove-time-part-of-datetime-in-sql-server) – Mikael Eriksson Nov 29 '11 at 17:42

1 Answers1

1

By casting to the new Date type in SQL server 2008 the time part will be removed.

SELECT CAST(tbl.ColumnName As Date)
FROM tbl
Magnus
  • 45,362
  • 8
  • 80
  • 118