Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

SQL 2008 T-SQL Expand / Collapse
Author
Message
Posted Friday, August 21, 2009 9:12 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 3:49 PM
Points: 31,161, Visits: 15,607
I missed that subtlety with 1 and 2. I've changed the answers to clean things up and will award back points.






Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #775152
Posted Friday, August 21, 2009 9:14 AM
UDP Broadcaster

UDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP BroadcasterUDP Broadcaster

Group: General Forum Members
Last Login: Friday, August 29, 2014 7:43 AM
Points: 1,480, Visits: 931
I read the first answer, knew it was right and ignored the rest. I don't see how doing nothing is an action


Post #775153
Posted Friday, August 21, 2009 9:17 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:58 AM
Points: 5,333, Visits: 25,272
Composed before I read Steve Jones post ....

Sorry about that Steve I should have hit the refresh before hitting post.


Scott Coleman
How on earth can you claim "no changes" is an action that was executed?

Cliff Jones
Yes, please explain the difference between answers 1 and 2 because it is very subtle


The action that was executed by the merge statement was the comparison between all the data in the table depts and all the data in table delta to determine if additional further action was required.

The objective of the QOD as I understand it is to get people thinking and learning. And the subtle actions of the merge is that all the rows in both tables are examined.

Scott Coleman
I'm really getting tired of questions that play word games


Scott Coleman - how about you submitting a QOD. It is quite a challenge.

Edited at 11:20 AM


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #775158
Posted Friday, August 21, 2009 9:39 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: 2 days ago @ 7:04 AM
Points: 1,100, Visits: 1,445
I'm not trying to be difficult here but I have to disagree with you bitbucket.

If I write an update statement i get a response along the lines of

23 row(s) affected

Your correct answer implies that what we should expect is

23 row(s) affected and 34 row(s) unaffected

which isn't the case. If a row is untouched, as row 1 is, the fact it was untouched is implicit and needs no explanation as such. I appreciate it was an error that has now been corrected but trying to defend it by suggesting we missed a subtlty of the question rather than admitting that it was wrong is missing the objective of the QotW as much as you suggest we are.

Paul
Post #775186
Posted Friday, August 21, 2009 2:28 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, September 23, 2014 2:10 PM
Points: 2,669, Visits: 781
Excellent question.

First because it demonstrates the MERGE,
Second because it illustrates the $action, and
Last because the format for the output makes the answer particularly clear.

Specifically:
INSERT 6 Production Jones NULL NULL NULL
UPDATE 2 Sales Erickson 2 Sales Byham
DELETE NULL NULL NULL 5 Manufacturing Brewer

Nice one!


Jamie
Post #775429
Posted Friday, August 21, 2009 3:29 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Wednesday, June 11, 2014 9:54 AM
Points: 912, Visits: 654
Jamie Longstreet (8/21/2009)
Excellent question.

First because it demonstrates the MERGE,
Second because it illustrates the $action,

Nice one!


Actually, I was going to say much the same but got a bit sidetracked by the answer confusion... I didn't know about MERGE before but thanks to this QotD it's clear how it works and it will be most helpful in solving a problem I have at work without resorting to extra and less efficient processing.

Cheers!
Post #775461
Posted Saturday, August 22, 2009 7:28 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:58 AM
Points: 5,333, Visits: 25,272

Jamie Longstreet (8/21/2009)
--------------------------------------------------------------------------------
Excellent question.

First because it demonstrates the MERGE,
Second because it illustrates the $action,

Nice one!


dave.farmer

Actually, I was going to say much the same but got a bit sidetracked by the answer confusion... I didn't know about MERGE before but thanks to this QotD it's clear how it works and it will be most helpful in solving a problem I have at work without resorting to extra and less efficient processing.Cheers!


Thank you for your responses, it is satisfying to recieve affirmation that the QOD has achieved at least a portion of its objective.


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #775558
Posted Tuesday, September 1, 2009 9:09 AM
SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Tuesday, July 23, 2013 6:34 AM
Points: 654, Visits: 265
Good question!
Post #780801
Posted Friday, November 20, 2009 10:50 PM


SSChasing Mays

SSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing MaysSSChasing Mays

Group: General Forum Members
Last Login: Friday, January 11, 2013 12:41 PM
Points: 621, Visits: 297
I was lucky I got it right!



Bhavesh Patel

http://bhaveshgpatel.wordpress.com/
Post #822838
Posted Friday, March 19, 2010 9:59 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 11:12 AM
Points: 7,791, Visits: 9,545
A nice question. I was lucky enough to see it after the wording was changed to reduce the number of correct answers to one.

But I do feel that this question illustrates how nasty MERGE is - we were better off without it, at least from the point of view of code clarity.


Tom
Post #886844
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse