I have the following SQL statement and I get the error:
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??
Updated
just does not exist. There are just INSERTED
and DELETED
. For updates, both are filled. Use INSERTED
to get the new values.