I am wondering if there is a good-performing query to select distinct dates (ignoring times) from a table with a datetime field in SQL Server.
My problem isn\'t getting
I've used the following:
CAST(FLOOR(CAST(@date as FLOAT)) as DateTime);
This removes the time from the date by converting it to a float
and truncating off the "time" part, which is the decimal of the float
.
Looks a little clunky but works well on a large dataset (~100,000 rows) I use repeatedly throughout the day.