Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Datetime in where clause

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' 
like image 374
Novice Developer Avatar asked Dec 22 '09 16:12

Novice Developer


People also ask

Can we use datediff in WHERE clause?

The DATEDIFF function can also be used in a WHERE clause as well as ORDER BY and HAVING clauses. The units of time available for the DATEDIFF are the same as those for the DATEADD function.


1 Answers

WHERE datetime_column >= '20081220 00:00:00.000'   AND datetime_column < '20081221 00:00:00.000' 
like image 87
LukeH Avatar answered Oct 02 '22 03:10

LukeH