http://www.sqlservercentral.com/blogs/steve_jones/2008/03/28/how-should-it-work/

Printed 2014/10/21 08:21AM

How Should It Work?

By Steve Jones, 2008/03/28

I was following a debate on the new Merge syntax in SQL Server 2008 with interest. It was somewhat of a debate about hot things should work, what happens with NULLs, etc. Now I don't want to recreate it here, but one thing was interesting to me. What would you expect from this?

 

Merge (select top 1 * from xxx where yyy)

 when matched ....

 when not matched ...

 ..

 

How many rows should be inserted? Would the top 1 that matched each section be inserted? I'd think only 1 row would be processed. To me the MERGE statement should only have 1 row input to it and whichever section it matched would process it.

 Is this not intuitive to anyone else?


Copyright © 2002-2014 Simple Talk Publishing. All Rights Reserved. Privacy Policy. Terms of Use. Report Abuse.