简体   繁体   English

SQL查询抛出此错误Msg 102,级别15,状态1,行1''附近的语法不正确

[英]SQL query is throwing this error Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '

Query is : 查询是:

select * from Test.dbo.Test_Spoc where spocNo = 54986 

In SQL 2008 its throwing error Incorrect syntax near ' '. 在SQL 2008中,其抛出错误''附近的语法不正确。 IF I remove the space before Where and again give the space its working. 如果我在Where之前删除了空格,然后再次使该空格起作用。 In SQL 2012 this query is showing red sign also before Where that problem is in this space. 在SQL 2012中,此查询在此空间中的问题之前也显示红色符号。

I want to know what can be reason that earlier space is not working? 我想知道早期空间无法使用的原因是什么?

select * from Test.dbo.Test_Spoc where spocNo = '54986'

Add single quotes, I think this might be the issue; 添加单引号,我认为这可能是问题所在; you check the code 您检查代码

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 消息 102,级别 15,State 1,第 8 行 '-' 附近的语法不正确,授予视图 SQL 服务器错误 - Msg 102, Level 15, State 1, Line 8 Incorrect syntax near '-' , Grant View SQL Server error SQL 错误:消息 102,级别 15,State 1,第 4 行“,”附近的语法不正确 - SQL ERROR : Msg 102, Level 15, State 1, Line 4 Incorrect syntax near ',' 消息102,级别15,状态1,第13行''附近的语法不正确 - Msg 102, Level 15, State 1, Line 13 Incorrect syntax near '?' 消息102,级别15,状态1,第8行在“ month”附近的语法不正确 - Msg 102, Level 15, State 1, Line 8 Incorrect syntax near 'month' 消息102,级别15,状态1,行1'''附近的语法不正确 - Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '(' 消息102,级别15,状态1,第2行','附近的语法不正确 - Msg 102, Level 15, State 1, Line 2 Incorrect syntax near ',' 消息102,级别15,状态1,第1行'/'附近的语法不正确 - Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '/' 消息102,级别15,状态1,行1'''附近的语法不正确 - Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' ' 消息102,级别15,状态1,第3行'='附近的语法不正确 - Msg 102, Level 15, State 1, Line 3 Incorrect syntax near '=' 消息102,级别15,状态1,第7行')'附近的语法不正确 - Msg 102, Level 15, State 1, Line 7 Incorrect syntax near ')'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM