Back
I have two tables where column [date] is the type of DATETIME2(0).
I have to compare two records only by their Date parts (day+month+year), discarding Time parts (hours+minutes+seconds).
How can I do that?
To compare the date part, you can use the CAST to the new DATE data type in SQL Server 2008
IF CAST(DateField1 AS DATE) = CAST(DateField2 AS DATE)
31k questions
32.8k answers
501 comments
693 users