0 votes
1 view
in SQL by (20.3k points)

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?

1 Answer

0 votes
by (40.4k points)

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)

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...