Tuesday, October 26, 2010

Where clasul on DATETIME column

Im chame to not know this but is there any beter way to use a where clasul on a datetime column? I was not able to figure out any other solution for the moment :-)

I would like to get data where the date is 25 okt 2010 for example.

SELECT name, date
FROM tabelname
WHERE
(DatePart(YYYY, date) = 2010 and DatePart(MM, date) = 10 and DatePart(dd, date) = 25)
order by name