• Something else I recently learned that I left out of the article for clarity is about duplicate keys in the source data.

    MERGE gets broken horribly if there are duplicate alternate keys in the <table_source> i.e. rows with the same customer_id in the @CustomerUpdates UDDT.

    A validation step to detect / remove any duplicates before the merge statement can help catch otherwise hard to detect errors.

    HTH