If you’re using the MERGE
statement in SQL Server to merge data between tables, you may or may not be aware that the statement gives us the ability to check which rows were affected by the MERGE
operation, as well as how they were affected.
To get this info, we can use the OUTPUT
clause along with the $action
argument.