Reputation: 4711
I am trying to get results back within year 'N' on a datetime column... I was hoping I could do something like this: DOD BETWEEN '2014-1-1' AND '2013-1-1' but I get nothing back with that.
Upvotes: 0
Views: 38
Reputation: 115560
So indexes can be used:
WHERE dod >= '2013-01-01'
AND dod < '2014-01-01'
or:
WHERE dod >= MAKEDATE(2013, 1) -- first day of the year
AND dod < MAKEDATE(2014, 1)
Upvotes: 2