I have two sql tables in the same db with identical structures. My desire is to take the records from mnitwo and insert them to mnione. There are no entries in mnione which exist in mnitwo, therefore no chance for duplication or the need to set conditions for 'if exists' of any kind. My question is, would i use the "merge" statement to get this done? using SQL 2008R2.
why would you use merge if you know there is no overlap?
Simply INSERT .... SELECT ....
You'd use MERGE if there is a possiblity of a match and then have a WHEN MATCHED BY source (with an update) and a WHEN NOT MATCHED (insert) clause.
Charlie =============================================================== Msg 3903, Level 16, State 1, Line 1736 The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
was trying that and getting a table definition mismatch error. i've since found the difference in structures between the two and the regular insert worked.