January 22, 2004 at 3:11 pm
Hello,
I have a field of type smalldatetime that I am trying to query, and for some reason, I can't get any results. The following is a sample query:
SELECT count(TestShortName)AS CTestShortName
FROM tblRC_StandardsTestScores03_04
WHERE InsertDate = '1/22/2004'
I know that the date in the condition is present in the field. I've done this before, I can't figure out why this won't work now.
Thanks for your help!
CSDunn
January 22, 2004 at 3:26 pm
use datediff(dd, InsertDate, '1/22/3004) in where clause instead.
January 22, 2004 at 3:28 pm
If there is a non-zero (i.e. non-midnight) time component to the date values, then your query will not find them. Try something like:
WHERE InsertDate >= '20040122' AND InsertDate < '20040123'
--Jonathan
January 22, 2004 at 3:35 pm
Thanks for your help!
CSDunn
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply