While trying to optimize a stored procedure using MERGE, I came across this article. How should we interpret the bold statement that it does not include comparisons with constants?
http://technet.microsoft.com/en-us/library/cc879317(v=sql.105).aspx
Only specify search terms in the ON clause that define the criteria for matching data in the source and destination tables. That is, specify only the columns from the target table that are compared with the corresponding columns in the source table. Do not include comparisons with other values, such as a constant.
Does this mean that I should avoid the ON statement, which looks like this?
ON [Source].[CategoryId] = [Target].[CategoryId] AND [Source].[Color] = @Color
Does this offer apply only to MERGE or to all types of JOINs?
source share