Sqlserver
 sql >> Datenbank >  >> RDS >> Sqlserver

SQL-Merge-Anweisung

Fügen Sie die Spalte ProcPOAmdDel_ChallanQty in die Quelltabelle ein, d. h. temp

MERGE PurProcessPOAmendmentDelivery AS pod
USING (SELECT ProcPOAmdDel_ProcessAmendmentId,
              rocPOAmdDel_SemiFinProdId,
              ProcPOAmdDel_ChallanQty
       FROM #TempTable ) AS temp
ON pod.ProcPOAmdDel_ProcessAmendmentId = temp.ProcPOAmdDel_ProcessAmendmentId AND 
pod.ProcPOAmdDel_SemiFinProdId=temp.ProcPOAmdDel_SemiFinProdId 
WHEN MATCHED THEN 
UPDATE SET pod.ProcPOAmdDel_ChallanQty = temp.ProcPOAmdDel_ChallanQty;