Here I will post problems I and my colleagues met and solutions we found.

Thursday, January 17, 2008

Extracting Date from DateTime in MS SQL

I don't know may be you know better way of extracting Date from DateTime in MS SQL, but the one I like is

DATEADD(d, 0, DATEDIFF(d, 0, [DateTime Column]))

Using conversion would be converting datetime to number, then to integer, then back to date. I didn't measure performance, but don't see much problems with arithmetic.

No comments: