In a SQL Server table, I have a field named Timestamp, which is a ‘datetime’ field. On a screen I have created, a user will pass in a date (no time), and I need to return all the records for that date.
Just doing Timestamp = @Date doesn’t seem to work unless the time in the field is 00:00:00. What is the most efficient way of doing this?
Since you’re on SQL Server 2008, you can use the
DATEdatatype.Do a comparison between
That should work and look just at the date – no time portion.