Here's what I use:
SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)
I'm thinking there may be a better and more elegant way.
Requirements:
- It has to be as fast as possible (the less casting, the better).
- The final result has to be a
datetimetype, not a string.