Seems like this comes up a lot so I thought I’d blog about a clean way I found to do this from a StackOverflow article. Basically, the problem is if you have a bunch of Sql records that have date and times in them (not 00:00:00 for time), using Microsoft’s SqlServer. You may want to query all records that are on a certain date. You can certainly for a query that looks like:
SELECT * FROM VolunteerJobs
WHERE JobStartTime >='08-01-2008' AND
However, this feels a little awkward. A better way that I plan on using is:
(day, datediff(day, 0, JobStartTime), 0) =
Somehow, it just feels better. HTH’s.