below86 (4/23/2014)
Lynn Pettis (4/23/2014)
below86 (4/23/2014)
Wouldn't it be better to use the BETWEEN with these dates?
WHERE (ath_postype = 'NTC' OR ath_postype='NTD')
AND ath_postdate BETWEEN '2013-01-01 00:00:00.000' AND '2013-01-05 23:59:59.000'
And what happens if the ath_postdate contains the value '2013-01-05 23:59:59.133'?
I knew that was coming as soon as I hit 'Post'. 🙂 In our case, at least as of right now, the dates don't carry the '.133'. I guess I could just change it to '2013-01-05 23:59.59.999'. My question was more towards using the BETWEEN than coding it with the >= and <=.
As others have already stated, that would actually round up to 2013-01-06 if the column were a DATETIME column because the resolution of DATETIME is 3.3ms. The BEST way (and I don't say that often) is to use the method that Scott and Lynn have both suggested. That way, it doesn't matter what the underlying DT datatype is... ever.
--Jeff Moden
Change is inevitable... Change for the better is not.