SQL Server Merge语句中的错误:列前缀“Updated”与查询中使用的表名或别名不匹配

时间:2020-11-29 22:25:50

I have the following SQL statement and I get the error:

我有以下SQL语句,我得到错误:

MERGE Target_Table AS Tg
USING #Temp_SourceTable AS So
ON (Tg.COl1 = So.COL1 AND 
    Tg.COL2 = So.COL2AND 
    Tg.COL3= So.COL3)
WHEN MATCHED THEN 
    Update set Tg.COl4= Tg.COL4 + So.COL4,
           Tg.COL5= '2014-01-03'
OUTPUT $action, Updated.*;

Error: The column prefix 'Updated' does not match with a table name or alias name used in the query

错误:列前缀“已更新”与查询中使用的表名或别名不匹配

Any thoughts on what I am missing here??

关于我在这里失踪的任何想法?

1 个解决方案

#1


3  

Updated just does not exist. There are just INSERTED and DELETED. For updates, both are filled. Use INSERTED to get the new values.

更新只是不存在。只有INSERTED和DELETED。对于更新,两者都填写。使用INSERTED获取新值。

#1


3  

Updated just does not exist. There are just INSERTED and DELETED. For updates, both are filled. Use INSERTED to get the new values.

更新只是不存在。只有INSERTED和DELETED。对于更新,两者都填写。使用INSERTED获取新值。