Every now and then I go to my blog to lookup something I wrote before only to find that I never posted it.
I would have bet someone $20 that I had posted something on how to strip off the time from a DateTime in SQL. Why would you do this?
Well, lets say that have some autogenerated DateTime field (CreatedOn?) that you later want to join with another field, but the other field only knows the DATE when something happened, not the exact Date and Time.
So, you can use the following code to just get the DATE and zero out the time component:
SELECT CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME)