tags:

views:

37

answers:

1
+2  A: 

with date/times like you have, there are fractions of a second too, in your query you use 'Aug 19 2009 4:29:03:000PM', the screen capture only shows seconds. if you want an exact match like you are doing you need to know the entire time:

select convert(char(23),YourDate,121) FROM YourTable

try "flooring" your date: http://stackoverflow.com/questions/85373/floor-a-date-in-sql-server

KM
Agreed. The max resolution of a DateTime is 3 milliseconds. That leaves roughly 333 possible values between 4:29:03:000 and 4:29:04:000.
Strommy
Running a function on a column as part of a where clause can result in poor query performance (on larger tables), as the server will be unable to use statistics or indexes for the column. Whilst it seems a bit of a hack, you could use the predicate: `WHERE [DateCompleted] BETWEEN @date AND @dateUpper` where @date is the original date you are after, and @dateUpper is a date 999ms later.
Jason Musgrove
problem is the SQL is generated by SubSonic so I can't adjust the query - I'll have to come up with a different solution that doesn't use date which isn't a problem - thanks for all the help!
Slee