简体   繁体   English

SQL DB2 SQL错误不正确的语法

[英]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'. 消息170,级别15,第113行,第113行:“ 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. 您的错误消息中提到了actual_completion_date但您的帖子中没有这样的标记。 So obviously you posted an error from a different T-SQL. 因此很明显,您发布了来自其他T-SQL的错误。

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

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

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