Icon

T-SQL Only return date in a date time.

Every once in a great while I need to just return the date of a date time and forget about the time part of it.

SELECT CAST(FLOOR(CAST(getDate() AS FLOAT)) AS DATETIME) as MyDate

Obviously you can replace getDate() with a column.

Category: Coding, Databases, MSSQL2005, SQL Server, T-SQL

Tagged:

Leave a Reply