|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:40 PM
Points: 5,228,
Visits: 7,019
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 7:14 AM
Points: 588,
Visits: 1,068
|
|
Given the MERGE statement below, which is completely correct for SQL Server 2005 and later
The MERGE statement is only available in SQL Server 2008 and later.
I don't think this has any bearing on the low percentage of people getting this right, though...!
|
|
|
|
|
Hall of Fame
       
Group: General Forum Members
Last Login: Today @ 1:49 AM
Points: 3,123,
Visits: 4,310
|
|
This was quite a tough one. Learned a fair bit about the origin of the MERGE statement from this.
Took a fair amount of thinking and digging to get it, though. I think the main reason for the poor score rate is that the SQL ANSI:2003 definitions are not readily available.
____________________________________________ Space, the final frontier? not any more... All limits henceforth are self-imposed. “libera tute vulgaris ex”
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Wednesday, February 06, 2013 11:51 PM
Points: 1,263,
Visits: 1,079
|
|
Stewart "Arturius" Campbell (11/25/2011) This was quite a tough one. Learned a fair bit about the origin of the MERGE statement from this.
I definitely second this.
Some may argue it's cheating to do some reading (researching) prior to answering the QotD, but I came across this interesting and helpful blog post by one Hugo Kornelis .
Hence a double thank you to Hugo for an excellent QotD on MERGE following the ANSI standard, and for sharing your extensive knowledge with everybody on the web.
You all have a great weekend, Michael
|
|
|
|
|
SSChasing Mays
      
Group: General Forum Members
Last Login: Today @ 4:13 AM
Points: 653,
Visits: 1,850
|
|
|
|
|
|
Mr or Mrs. 500
      
Group: General Forum Members
Last Login: Today @ 7:14 AM
Points: 588,
Visits: 1,068
|
|
I came across this interesting and helpful blog post by one Hugo Kornelis  . Hence a double thank you to Hugo for an excellent QotD on MERGE following the ANSI standard, and for sharing your extensive knowledge with everybody on the web.l
Thank you Michael (and Hugo!) for that very useful link.
Despite my minor bit of pedantry about the SQL versions, I second your thanks to Hugo - I always read his contributions with interest and often learn from them.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 2:40 PM
Points: 5,228,
Visits: 7,019
|
|
Thanks, all, for the kind words! I am glad you all find my questions entertaining and informative.
martin.whitton (11/25/2011) The MERGE statement is only available in SQL Server 2008 and later. Oops! Stupid mistake - sorry 'bout that!
Stewart "Arturius" Campbell (11/25/2011) I think the main reason for the poor score rate is that the SQL ANSI:2003 definitions are not readily available. I included a link to a freely available version (of a late draft, not the official final version) in the answer's explanation. When I first found this link, I immediately downloaded it to my computer for fear of it being removed. When I submitted the question, I had to use Google to re-find the link. As far as I know, there are no newer versions of the ANSI SQL standard that are freely available (unfortunately).
By the way - after submitting this question, I found that most of the non-SQL:2003 stuff in MERGE was not added by Microsoft for SQL Server only, but is defined in SQL:2008. So I was very glad that I included the version of the standard in the question!
Hugo Kornelis, SQL Server MVP Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:22 PM
Points: 7,074,
Visits: 7,108
|
|
Good question and good explanation - and thanks especially for the link to a late draft of the SQL 2003 standard.
It was a bit hard for a Friday question, just when people are getting ready to relax for the weekend (careless scheduling by Steve there, or did he do it on purpose?). I spent a long time racking my brain to try to remember which was the fourth box to tick - after I had ticked three boxes all the others seemed as if they ought to be left unticked; and then I clicked that only UPDATE was allowed in WHEN MATCHED, not DELETE, so as I had already ticked WHEN NOT MATCHED BY SOURCE I logically had to tick DELETE as my fourth choice.
Definitely good excercise for the grey matter.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 4:22 PM
Points: 7,074,
Visits: 7,108
|
|
martin.whitton (11/25/2011) The MERGE statement is only available in SQL Server 2008 and later.
I don't think this has any bearing on the low percentage of people getting this right, though...! Actually the percentage doesn't seem too bad - up to now 12% got it right; that's a bit more than four times as many as would be expected if everyone ticked 4 boxes chosen at random from the seven boxes provided. There have been much worse responses to other questions.
But I agree this one was pretty hard.
Tom Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Yesterday @ 9:58 AM
Points: 2,570,
Visits: 1,530
|
|
| Nice question Hugo, had to do some research before answering this one and I still was surprised that I got it right. I think my brain now hurts too much to get anything else done today. Happy Friday!
|
|
|
|