KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Which method provides the best performance when removing the time portion from a datetime field in SQL Server? a) select DATEADD(dd, DATEDIFF(dd, 0, getdate()), 0) or b) select cast(convert(char(11), getdate(), 113) as datetime) The second method does send a few more bytes either way but that might not be as important as the speed of the conversion. Both also appear to be very fast, but there might be a difference in speed when dealing with hundreds-of-thousands or more rows? Also, is it possible that there are even better methods to get rid of the time portion of a datetime in SQL?
Tags (comma-separated)
Save Edits
Cancel