Hi.
What is the MOST efficient way to round a datetime field BACK to the hour.
For example
select GetDate()
might return 2001-01-17 11:42:01.163.
Now I want to return 2001-01-17 11:00:00.000.
Efficiency is the key word here. I am using within the Query Analyzer the
following, which works. But, when doing this to a millions of rows in a
table, the speed is poor. What would be your suggestions.
select GetDate(),dateadd(hour,DATEPART(hour,
getdate()),convert(datetime,(Convert(varchar,GetDate(),112))))
Thanks,
blue