Check date between two dates in T-SQL

I think WHERE DATE BETWEEN '2013-09-10 00:00:00.00' and GETDATE() (without the single quotes around the GETDATE() call) should work just fine.


'GETDATE()' is a string literal, GETDATE() is a T-SQL function.

Your query should look like:

SELECT a , b
FROM myTbl
WHERE DATE BETWEEN '2013-09-10 00:00:00.0' and GETDATE()

A pair of DATEADD/DATEDIFF calls will round a date down to the previous midnight:

SELECT a , b
FROM myTbl
WHERE DATE BETWEEN DATEADD(day,DATEDIFF(day,0,GETDATE()),0) and GETDATE()

Alternatively, if you're on SQL Server 2008 or later:

SELECT a , b
FROM myTbl
WHERE DATE BETWEEN CONVERT(date,GETDATE()) and GETDATE()