Blog Post

How Should It Work?

,

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?

Rate

Share

Share

Rate