MERGE statement is a great addition to the T-SQL language. It provides a concise and efficient mechanism to perform multiple operations on a table based on contents in a source table without having to resort to using a cursor or running multiple set-oriented operations against the table. However, you should keep in mind some guidelines and best practices to help ensure that you get the best performance from your
First, you should try to reduce the number of rows accessed by the
MERGE statement early in the process by specifying any additional search condition to the
ON clause that filters out rows that do not need to be processed. You should avoid using the conditions in the ...