THE SQL Server Blog Spot on the Web

Welcome to SQLblog.com - The SQL Server blog spot on the web Sign in | |
in Search

Michael Zilberstein

MERGE statement syntax modified

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.

Published Tuesday, September 16, 2008 10:03 PM by Michael Zilberstein
Filed under: ,

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(required) 
Submit
Powered by Community Server (Commercial Edition), by Telligent Systems
  Privacy Statement