如何解决错误消息102,级别15,状态1,行1'00'附近的语法不正确。在SQL中 [英] how to solve error Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '00'. in SQL
本文介绍了如何解决错误消息102,级别15,状态1,行1'00'附近的语法不正确。在SQL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的团队,
我很困惑在单引号中得到日期。我知道我忘记用单引号来获取日期。请亲切指导我
我的查询如下:
Dear Team,
I got confused to get the date in Single Quotes.I know that i forgot to put the single quotes to get the date .Please kindly guide me
I have the query as follow:
select count(ID) as count from Customerloandata with (nolock) where createdby = 4 AND isnull(QCPROCESSED,0) = 0 AND isnull(QCTOVERIFY,0) = 1 and isnull(deleted,0) = 0 AND createdon >=2014-01-01 00:00:00 and createdon<=2014-04-01 00:00:00
我收到错误
I am getting the error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '00'.
谢谢
Harshal
Thanks
Harshal
推荐答案
试试这个:
Try this:
select count(ID) as count from Customerloandata with (nolock) where createdby = 4 AND isnull(QCPROCESSED,0) = 0 AND isnull(QCTOVERIFY,0) = 1 and isnull(deleted,0) = 0 AND createdon >='2014-01-01 00:00:00' and createdon<='2014-04-01 00:00:00'
你在日期时间字符串中缺少引号。
you are missing quotes in datetime string.
select count(ID) as count from Customerloandata with (nolock) where createdby = 4 AND isnull(QCPROCESSED,0) = 0 AND isnull(QCTOVERIFY,0) = 1 and isnull(deleted,0) = 0 AND createdon >='2014-01-01 00:00:00' and createdon<='2014-04-01 00:00:00'
这篇关于如何解决错误消息102,级别15,状态1,行1'00'附近的语法不正确。在SQL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文