Skip to content
Advertisement

Update and insert to one table from another

I have two tables:

table1: (ID, Code, Name)
table2: (ID, Code, Name) with same columns

I want to to insert data from table1 to table2 or update columns if that exists in table2 (table1.ID = table2.ID)

What is the simple way to do this?

WITH OUT MERGE

Advertisement

Answer

There are some issues with Merge statement,so it should be used with caution..

Further i recommend ,using merge as two seperate DML statements like below..

Reasons being stated by Paul White here in his detailed answer..

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement