SQL Transaction Node MERGE - Stopped Working

 1 Replies
 0 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
FireGeek21
Veteran Member
Posts: 84
Veteran Member

    We have a process flow whereby the final SQL Transaction seems to have stopped working.  We can execute the UPDATE function via SQL Mgmt Studio but it will not function in the process flow.  The flow doesn't have any errors in the log file.  All columns are in the right order.  I have replaced the node.  I have rewrote the whole flow.  Nothing seems to work.

     

    Thoughts?

     

    MERGE dbName.dbo.tblTarget as T
    USING dbName.dbo.tblSource as S
    ON (T.PeopleID = S.PeopleID)
    WHEN MATCHED THEN
    UPDATE SET T.FirstName=S.FirstName, T.MiddleName=S.MiddleName, T.LastName=S.LastName,  T.StartDate=S.StartDate,  T.EndDate=S.EndDate,  T.Credential=S.Credential,  T.Category=S.Category,  T.Position=S.Position,   T.Department=S.Department,  T.Status=S.Status,  T.PeopleIDAlt=S.PeopleIDAlt,  T.BadgeBarCode=S.BadgeBarCode
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (PeopleID, FirstName, MiddleName, LastName, StartDate, EndDate, Credential, Category, Position, Department, Status, PeopleIDAlt, BadgeBarCode)  VALUES (S.PeopleID, S.FirstName, S.MiddleName, S.LastName, S.StartDate, S.EndDate, S.Credential, S.Category, S.Position, S.Department, S.Status, S.PeopleIDAlt, S.BadgeBarCode)
    OUTPUT $action;

    FireGeek21
    Veteran Member
    Posts: 84
    Veteran Member
      I figured out the issue! MERGE doesn't like duplicates of any kind. If it comes across a duplicate, it will not error. It just will not update. The log file from the workunit appears as if the records were inserted/updated but when doing an independent single table query of the affected table(s) you will find the records were not touched.

      Fixed with a simple correction to GHR data and update the process flow to account for multiple departments selected (ancillary application that permits this).