开发者

Msg 102, Level 15, State 1, Line 1 Incorrect syntax near ' '

开发者 https://www.devze.com 2022-12-28 22:31 出处:网络
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 \' \'.

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** 


For the OP's command:

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:

from [#tmp_CTF**]

if that is the table name.

0

精彩评论

暂无评论...
验证码 换一张
取 消