简体   繁体   中英

SQL DB2 sql error INCORRECT SYNTAX

What am I missing in this code below that will cause the error:

Msg 170, level 15, line 113 line 113: Incorrect syntax near 'actual_completion_date'.

update #Loss_mit_step
set
 [STEP924_COMPL_DATE] = Case when step_code ='924' then ls_actual_completion_date else ' ' end,
 [STEP926_COMPL_DATE] = Case when step_code ='926' then ls_actual_completion_date else ' ' end,
 [STEP927_COMPL_DATE] = Case when step_code ='927' then ls_actual_completion_date else ' ' end,
 [STEP928_COMPL_DATE] = Case when step_code ='928' then ls_actual_completion_date else ' ' end,
 [APPROVAL_DATE] = Case when step_code ='Q28' then ls_actual_completion_date else ' ' end

You appear to have an extra comma in the statement, at the very end.


I suggest you comment out each of the "case" lines, one by one, until you find out what the problem is, or until you only have one line left.

What you posted is syntactically correct, so you cannot get a syntax error. It actually parses fine. Your error message mentions actual_completion_date but you have no such token in your post. So obviously you posted an error from a different T-SQL.

我发现了错误的原因:在第一行的Actual_completion_date前面有一个空格。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM