Click here to Skip to main content
15,891,951 members

Comments by Member 13896879 (Top 1 by date)

Member 13896879 12-Jul-18 3:15am View    
The output from the merge statement will be rows that have been inserted or deleted. The way does updates or for these purposes, matches will be to delete the row then insert the same row with the updated value maintaining the primary key values. Also worth noting the $action will denote what action was taken on the row sop INSERT, UPDATE or DELETE.

Below is some more information on the $action column. Hopefully this will help you sift the results so you can commit them to your third table

$action
Is available only for the MERGE statement. Specifies a column of type nvarchar(10) in the OUTPUT clause in a MERGE statement that returns one of three values for each row: 'INSERT', 'UPDATE', or 'DELETE', according to the action that was performed on that row.