'DATE' 不是可识别的内置函数名称 [英] 'DATE' is not a recognized built-in function name
本文介绍了'DATE' 不是可识别的内置函数名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想查找当天的所有记录.我有一个日期类型的字段日期.我在 sql server 上遇到错误
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 function name.
在这条线上
(DATE(EnterDate) = CURDATE() )
推荐答案
如错误所述,SQL Server 2008 或 2012 中没有 DATE
function(您标记为两者都一样,所以我不确定您的目标是哪个).但是,您可以在 SQL Server 2008 及更高版本中强制转换为 date
类型:
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())
请注意,也没有 CURDATE
函数,因此我已将其转换为 GETDATE()
Note that there's no CURDATE
function either, so I've translated that to GETDATE()
这篇关于'DATE' 不是可识别的内置函数名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文