Archive: November 2019

  • Capturing Insert and Update Counts from Merge

    This post shows hows how you can capture and store the number of records inserted, updated or deleted from a T-SQL Merge statement. This is in response to a question on an earlier post about using Merge to load SCDs in a Data Warehouse. You can achieve this by using the OUTPUT clause of a merge statement, including the $Action column that OUTPUT returns. The basic syntax is: INSERT INTO XXXX SELECT [Action] FROM ( MERGE XXXX AS Target USING XXXX…

    » Read more