'DATE' is not a recognized built-in function name 'DATE' is not a recognized built-in function name sql sql

'DATE' is not a recognized built-in function name


As the error states, there is no DATE function in SQL Server 2008 or 2012 (you tagged both so I'm not sure which you're targeting). You can, however, cast to a date type in SQL Server 2008 and above:

WHERE EnterDate = CONVERT(date,GETDATE())

Note that there's no CURDATE function either, so I've translated that to GETDATE()


Use the following condition in your where cluase

WHERE CAST(DateColumn AS DATE) = CAST(GETDATE() AS DATE)              ^------------ Your Column Name with `Date` or 'DateTime'  data type

CURDATE() is a mysql function, In Sql-Server we have GETDATE() function to get current date and time.


More efficient one is

WHERE EnterDate > DATEADD(dd, -1, DATEDIFF(dd, 0, GETDATE()))

Thanks @D Stanley @marc_S and @Mihai