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 ««12345»»»

GO Part 2 Expand / Collapse
Author
Message
Posted Thursday, September 13, 2012 3:00 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, August 27, 2013 4:28 AM
Points: 1,248, Visits: 779
Sorry to be pedantic, but I feel I have to in this case.

GO, or NotGo, aside not one person can run this complete script without modification or error.

@Test is DECLARE'd twice

I want my point!


_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
Post #1358412
Posted Thursday, September 13, 2012 3:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 18, 2014 5:33 AM
Points: 6, Visits: 100
We all know that go is an SSMS denotation for separating batches. Effectively, you challenged a system 1 type response that required a system 2 type response. You tricked us into not knowing some extraneous fact about modifying go to not go using osql. Why anybody would configure a particular machine to use notgo rather than go, is beyond me aside from some bizarre security policy. I find this kind of question, pretty much pointless.
Post #1358415
Posted Thursday, September 13, 2012 3:26 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 1:14 PM
Points: 5,977, Visits: 8,237
DugyC (9/13/2012)
Sorry to be pedantic, but I feel I have to in this case.

GO, or NotGo, aside not one person can run this complete script without modification or error.

@Test is DECLARE'd twice

I want my point!

If you change the SSMS configuration to use NotGo as batch seperator, then the script supplied will contain two batches. In each of those batches, @Test is declared exactly once. It should run perfectly. As you would have known if you have started SSMS and tested it. (Don't forget to set the batch seperator back to GO after you finish testing!)


zak_willis (9/13/2012)
We all know that go is an SSMS denotation for separating batches. Effectively, you challenged a system 1 type response that required a system 2 type response. You tricked us into not knowing some extraneous fact about modifying go to not go using osql. Why anybody would configure a particular machine to use notgo rather than go, is beyond me aside from some bizarre security policy. I find this kind of question, pretty much pointless.

I have no idea what type 1 and type 2 responses are, but I disagree with the rest of your reaction. I don't feel tricked at all by this question. The question included the fragments "made to run ... without error" (which communicates that you have to do SOMETHING to achieve that result" and "without changing the script" (implying that everything else is fair game to be changed). So basically, the question is "did you know that you can change the batch seperator".

I agree that the ability to change the batch seperator is quite bizarre and probably quite pointless, but many QotDs are about bizarre and pointless tidbits of knowledge. I consider the QotD as a sort of fun trivia quiz rather than as a measurement of my ability to excell in my job. Many trivia questions are utterly pointless (but fun).

Finally, I can give you one example where this knowledge can be useful: when you have a co-worker whose idea of fun it is to change the batch seperator to, for instance, "SELECT" when you are away from your keyboard, and then watch you struggle to understand why your code is not working anymore. After this QotD, you will probably be able to recognise and fix the problem much faster than you otherwise would have.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #1358426
Posted Thursday, September 13, 2012 3:35 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, August 27, 2013 4:28 AM
Points: 1,248, Visits: 779
Hugo Kornelis (9/13/2012)
If you change the SSMS configuration to use NotGo as batch seperator, then the script supplied will contain two batches. In each of those batches, @Test is declared exactly once. It should run perfectly. As you would have known if you have started SSMS and tested it. (Don't forget to set the batch seperator back to GO after you finish testing!)


Again, I'm wrong, thanks Hugo

I did test it, but was too stupid to see what would have been seperate batches with the NotGo, and focused on the Declare instead... I'm going back to bed, I'll start the day again tomorrow


_____________________________________________________________________
"The difficult tasks we do immediately, the impossible takes a little longer"
Post #1358431
Posted Thursday, September 13, 2012 3:35 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: 2 days ago @ 1:00 AM
Points: 3,060, Visits: 3,246
Good question - thanks

-------------------------------
Posting Data Etiquette - Jeff Moden
Smart way to ask a question

There are naive questions, tedious questions, ill-phrased questions, questions put after inadequate self-criticism. But every question is a cry to understand (the world). There is no such thing as a dumb question. ― Carl Sagan
I would never join a club that would allow me as a member - Groucho Marx
Post #1358432
Posted Thursday, September 13, 2012 3:42 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Friday, January 31, 2014 2:56 AM
Points: 483, Visits: 256
A good and tricky one. Thank you.
Post #1358436
Posted Thursday, September 13, 2012 3:48 AM


SSC Eights!

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

Group: General Forum Members
Last Login: 2 days ago @ 12:47 PM
Points: 919, Visits: 2,090
Hugo Kornelis (9/13/2012)

Finally, I can give you one example where this knowledge can be useful: when you have a co-worker whose idea of fun it is to change the batch seperator to, for instance, "SELECT" when you are away from your keyboard, and then watch you struggle to understand why your code is not working anymore. After this QotD, you will probably be able to recognise and fix the problem much faster than you otherwise would have.


+1

Few minutes ago did this on my coworker's system and provided this link qtod to solve it.... (for him I was genius.... )


ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
Post #1358439
Posted Thursday, September 13, 2012 4:13 AM
SSC Eights!

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

Group: General Forum Members
Last Login: Thursday, August 14, 2014 7:02 AM
Points: 892, Visits: 1,240
Misread the true meaning of the question so got it wrong. Thanks for the followup discussion as I struggled with this one.
Post #1358451
Posted Thursday, September 13, 2012 4:55 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: 2 days ago @ 1:51 PM
Points: 21,644, Visits: 15,317
Good question



Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #1358470
Posted Thursday, September 13, 2012 4:56 AM


Say Hey Kid

Say Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey KidSay Hey Kid

Group: General Forum Members
Last Login: Thursday, June 12, 2014 4:19 AM
Points: 701, Visits: 1,145
Learned something but it was a horribly presented question. Can't believe it got through any type of quality assurance.
Post #1358471
« Prev Topic | Next Topic »

Add to briefcase ««12345»»»

Permissions Expand / Collapse