SQL 消息 102,级别 15,状态 1,第 1 行 '?' 附近的语法不正确
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2744280/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near '?'
提问by sajad
I am trying to query from a temp table and i keep getting this message:
我正在尝试从临时表进行查询,但不断收到此消息:
Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '.
Can somebody tell me what the problem is? Is it due to convert?
有人能告诉我问题是什么吗?是因为转换吗?
The query is
查询是
select compid,2, convert(datetime, '01/01/' + CONVERT(char(4),cal_yr) ,101) ,0,? Update_dt, th1, th2, th3_pc , Update_id, Update_dt,1
from #tmp_CTF**
采纳答案by KM.
For the OP's command:
对于 OP 的命令:
select compid,2, convert(datetime, '01/01/' + CONVERT(char(4),cal_yr) ,101) ,0, Update_dt, th1, th2, th3_pc , Update_id, Update_dt,1
from #tmp_CTF**
I get this error:
我收到此错误:
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '*'.
when debugging something like this split the long line up so you'll get a better row number:
在调试这样的东西时,将长线分开,这样你就会得到一个更好的行号:
select compid
,2
, convert(datetime
, '01/01/'
+ CONVERT(char(4)
,cal_yr)
,101)
,0
, Update_dt
, th1
, th2
, th3_pc
, Update_id
, Update_dt
,1
from #tmp_CTF**
this now results in:
这现在导致:
Msg 102, Level 15, State 1, Line 16
Incorrect syntax near '*'.
which is probably just from the OP not putting the entire command in the question, or use [ ] braces to signify the table name:
这可能只是来自 OP 没有将整个命令放在问题中,或者使用 [] 大括号来表示表名:
from [#tmp_CTF**]
if that is the table name.
如果那是表名。