|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:12 AM
Points: 1,164,
Visits: 730
|
|
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"
|
|
|
|
|
Forum Newbie
      
Group: General Forum Members
Last Login: Monday, October 29, 2012 8:29 AM
Points: 6,
Visits: 99
|
|
| 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.
|
|
|
|
|
SSCertifiable
       
Group: General Forum Members
Last Login: Today @ 12:02 PM
Points: 5,243,
Visits: 7,055
|
|
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
|
|
|
|
|
Ten Centuries
      
Group: General Forum Members
Last Login: Today @ 7:12 AM
Points: 1,164,
Visits: 730
|
|
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"
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Today @ 8:50 AM
Points: 2,476,
Visits: 2,138
|
|
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
|
|
|
|
|
SSC Veteran
      
Group: General Forum Members
Last Login: Friday, February 22, 2013 2:56 AM
Points: 225,
Visits: 178
|
|
| A good and tricky one. Thank you.
|
|
|
|
|
SSC-Addicted
      
Group: General Forum Members
Last Login: Today @ 4:05 AM
Points: 446,
Visits: 1,198
|
|
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 -- There are only 10 types of people in the world, those who understand binary, and those who don't.
Note: (as of now) only.. 1 and 4 applies (i am on my way...)
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Today @ 4:28 AM
Points: 695,
Visits: 1,023
|
|
| Misread the true meaning of the question so got it wrong. Thanks for the followup discussion as I struggled with this one.
|
|
|
|
|
SSCoach
         
Group: General Forum Members
Last Login: Monday, May 20, 2013 1:07 PM
Points: 18,733,
Visits: 12,332
|
|
|
|
|
|
Say Hey Kid
      
Group: General Forum Members
Last Login: Friday, April 19, 2013 10:27 AM
Points: 690,
Visits: 1,100
|
|
| Learned something but it was a horribly presented question. Can't believe it got through any type of quality assurance.
|
|
|
|