Implementing MERGE Functionality
A database may need to perform either an insert of an update, depending on whether a particular row already exists in the database.
Without using the MERGE statement, the following is one approach you can use in Transact-SQL:
UPDATE mytable SET col=@somevalue WHERE myPK = @parm IF @@ROWCOUNT = 0 INSERT mytable (columns) VALUES (@parm, @other values)
Another Transact-SQL method to implement a merge:
For a natively compiled stored procedure