This is probably known to all but I've just found out - MERGE command syntax had been modified since CTP6. In the beginning of 2008 I had built a system on CTP6 and this week, while preparing for production deployment, found out that procedures are failing with syntax error. It appears that in CTP6 MERGE contained the following blocks:
- WHEN MATCHED
- WHEN [TARGET] NOT MATCHED
- WHEN SOURCE NOT MATCHED
In RTM, if you write WHEN TARGET NOT MATCHED, it fails compilation. New syntax is:
- WHEN MATCHED
- WHEN NOT MATCHED [BY TARGET]
- WHEN NOT MATCHED BY SOURCE
For non-believers, here is old blog post by Chad Boyd with examples that use old syntax.