I have a table with a column of type dateTime. I want to do a query that selects all rows that take place on that date. Basically,
SELECT * FROM Table
WHERE [timeStamp] = '02-15-2003'
But that only returns rows where [timeStamp] is ’02-15-2003 00:00:00.000′, but really I want rows from anytime that day.
If you have indexes, you are going to want something which doesn’t prevent the indexes from being used:
You can do a truncation operation on the
[timeStamp]column to get rid of any time part (implementation dependent), but this can potentially hurt the execution plan. Unfortunately, you really have to look at the execution plan to see this, because sometimes the optimizer is clever about some functions and sometimes it isn’t.