Lynn Pettis (11/30/2009)
Dude76 (11/30/2009)
I will personaly prefer to do something like cast(cast(getdate() as int) as datetime) to obtain de date of the day at midnight rather using datediff+dateadd functions.There has been several discussions regarding this and iirc it was actually proven that the dateadd/datediff method is actually faster. Also, it doesn't use the knowledge of how datetime values are stored. If MS changes this, the dateadd/datediff method should still work as advertised.
Oh, faster rather cast, really ?
I didn't know that, and were sure that cast were a fast operation front of manipulating functions.
Thx for the info, i'll test if to have an idea of the difference of performance.