Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Merge question

Author  Topic 

seware
Starting Member

11 Posts

Posted - 2011-09-20 : 12:30:17
Using a "merge" query...

If the resultset of the "using" statement is empty, would any of the "match" statements be met?

In other words, if "using" is empty does SQl Server even try to match a condition or just bail out? I guess I'm asking if I need to handle the case where "using" is emtpty or does the merge just exit nicely?

I could add a "when not matched" in addition to the "when not matched by target" I already have, but I'm not sure if I need to or not.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-20 : 12:38:27
you need to include it in when not matched by source i think .

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -