Question

SubhadipRoy on Wed, 10 May 2017 14:06:31


while updating the table and using the same table in the JOIN criteria , the target table is not getting updated.

Staging Table JOIN with Target table on Staging Table.Id== Target Table.Id and some condition

UPDATE TRG

SET TRG.Name=STG.Name

FROM TargetTable  AS TRG

INNER JOIN StagingTable AS STG

ON TRG.Id =STG.Id 

The above Update is not working . Please suggest

Even tried with 

UPDATE TargetTable

SET TargetTable.Name=STG.Name

FROM    StagingTable AS STG  

where TargetTable.Id =STG.Id



Sponsored