CFF KB - Carrz-Fox-Fire Promotions Knowledge Base

CFF KB is all about 1 thing: The Sharing of Knowledge and the Power we gain from it.
  • Breadrumbs:
  • The MERGE statement attempted to UPDATE or DELETE the same row more than once.

  • CFF Knowledge Base - Share With Facebook CFF Knowledge Base - Share on Twitter CFF Knowledge Base - Share on Reddit CFF Knowledge Base - Share on Digg It CFF Knowledge Base - Share on Stumble Upon It CFF Knowledge Base - Share on Delicious
    Share With Friends (Updated 6-8-2010)
  • Article ID:
    7293
  • Date Created
    Sunday, February 15, 2026
  • Last Updated
    Sunday, February 15, 2026
  • This Article Has been Viewed
    0 times
  • Short Desc

    When merging data between tables in SQL Server, multiple rows may be sent simultaneously. This is not allowed and will cause the 'MERGE statement attempted'.
  • Article Details

    Whether you are running a Script in SQL Server Management Studio, or in a website running ASP Classic or ASP.NET. If your table contains multiple rows that are of the same value, this will cause your Script to receive the following error.

     

    Msg 8672, Level 16, State 1, Line 18
    The MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row matches more than one source row. A MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.
  • Recreate Issue

    The following code sample will give the "MERGE statement attempted" error.

     
    with s1 as (SELECT mt.ITTempID, COALESCE(
  • Resolve Issue

    To correct the issue, we need to add a TOP 1 to our Main Select Statement.
    In your code, add this to the Statement that wraps all other code.
     
    with s1 as (SELECT top 1 mt.ITTempID, COALESCE(


    Review this KB Article to further resolve this issue.

    --------
    Related Articles

    The MERGE statement attempted to UPDATE or DELETE the same row more than once.«