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

前端 未结 5 569
小蘑菇
小蘑菇 2021-01-05 05:12

I wish to find all records of the current day. I have a field Date of type DATE. I am getting error on sql server

\'DATE\' is not a recognized built-in funct         


        
5条回答
  •  说谎
    说谎 (楼主)
    2021-01-05 05:34

    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()

提交回复
热议问题