|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:17 AM
Points: 460,
Visits: 2,521
|
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, March 13, 2013 10:51 PM
Points: 161,
Visits: 301
|
|
But why use XML to pass data in, when SQL2008 gives you Table-Value Parameters?
(I do love Merge - I spoke on it last month at the UG I run, and I'll be presenting on it in the next few months at other user-groups and at a code-camp too).
Rob Farley LobsterPot Solutions & Adelaide SQL Server User Group Company: http://www.lobsterpot.com.au Blog: http://sqlblog.com/blogs/rob_farley
|
|
|
|
|
Grasshopper
      
Group: General Forum Members
Last Login: Sunday, July 26, 2009 7:03 PM
Points: 13,
Visits: 20
|
|
Surely the set d.ItemNumber = o.ItemNumber isn't needed as the "join" is on OrderNumber and ItemNumber: MERGE OrderDetails AS d 48 USING OrderInfo AS o 49 ON (d.OrderNumber = o.OrderNumber AND d.ItemNumber = o.ItemNumber) WHEN MATCHED THEN 51 UPDATE SET 52 d.ItemNumber = o.ItemNumber, Regards Leo
|
|
|
|
|
SSC-Enthusiastic
      
Group: General Forum Members
Last Login: Wednesday, March 13, 2013 10:51 PM
Points: 161,
Visits: 301
|
|
Yes Leo, that's correct.
Rob Farley LobsterPot Solutions & Adelaide SQL Server User Group Company: http://www.lobsterpot.com.au Blog: http://sqlblog.com/blogs/rob_farley
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Friday, May 15, 2009 5:58 AM
Points: 2,
Visits: 7
|
|
Hi, Effectively, it seems really easy to use it. But what about performances? Is there any difference between using MERGE and using 'old' code ? And what about MERGE and global SQL specifications? Is there a chance to have this keyword appears on the next sql language norm? Anyway, thanks for this article. I'm impatient to install this new version to play with it Have a nice day PS: ALL WITH ME BEHIND FRENCH RUGBY TEAM (They need it :blush
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:17 AM
Points: 460,
Visits: 2,521
|
|
Hi Rob, The focus of this article was to present the MERGE keyword and hence I started from where we stopped in a previous article. There is another article scheduled, which introduces the table-value parameter and will be out in the next few days. thanks Jacob
.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Saturday, May 11, 2013 8:17 AM
Points: 460,
Visits: 2,521
|
|
|
|
|
|
SSCertifiable
       
Group: Moderators
Last Login: Thursday, May 09, 2013 12:38 PM
Points: 6,462,
Visits: 1,384
|
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Tuesday, May 14, 2013 4:39 PM
Points: 6,260,
Visits: 1,977
|
|
Merge has been present in DB2 for years, it is a good thing that MS is catching up. Personally I find it handy for cetain things but I am afraid that this can be used on situations where a better application design is the key.
Thanks for the article. Simple and to the point.
* Noel
|
|
|
|
|
Right there with Babe
      
Group: General Forum Members
Last Login: Yesterday @ 9:18 AM
Points: 772,
Visits: 1,825
|
|
What about REPLACE INTO? That would be easier on the coders. The way it's supposed to work is that if the primary key does not exists the row gets inserted. If the row does exist it gets replaced. There was some talk that rows affected would come ack as 1 if the insert happened and 2 if the row was replaced. The thinking being that the replace was like a delete and an insert. If I'm going to have to code procedures then I'll just code the procedures. There is only one possible benefit from doing things the MERGE way. I can update an existing order in my order table but new orders could get put into a new_order table. Why you would want to do that I don't know. I was jumping up and down happy when I read the article headline and then so dissapointed when I saw the syntax.
ATB
Charles Kincaid
|
|
|
|