Datetime in where clause

Novice Developer picture Novice Developer · Dec 22, 2009 · Viewed 422.5k times · Source

How can I select 12/20/2008 in where clause of sql?

The server is SQL server 2005.

select * from tblErrorLog
where errorDate = '12/20/2008'

Answer

LukeH picture LukeH · Dec 22, 2009
WHERE datetime_column >= '20081220 00:00:00.000'
  AND datetime_column < '20081221 00:00:00.000'