GO Part 2

  • Kenneth.Fisher

    SSCoach

    Points: 19597

    Comments posted to this topic are about the item GO Part 2

    Kenneth FisherI was once offered a wizards hat but it got in the way of my dunce cap.--------------------------------------------------------------------------------For better, quicker answers on T-SQL questions, click on the following... http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]For better answers on performance questions, click on the following... http://www.sqlservercentral.com/articles/SQLServerCentral/66909/[/url]Link to my Blog Post --> www.SQLStudies.com[/url]

  • Ron McCullough

    SSC Guru

    Points: 63877

    Nice simple straight forward question - glad I remembered the correct answer from a long, long time ago.

    I know it is still early and not too many have attempted to answer the question, but I am still suprised at the number of wrong answers.

    Correct answers: 40% (2)

    Incorrect answers: 60% (3)

    Total attempts: 5

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

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Joy Smith San

    SSC-Insane

    Points: 24877

    I din't know this at all or perhaps I never noticed it as we always go with the default ones.

    However I got it right by guessing, this question would not have been asked otherwise.

    It made me to have a look at all the settings thoroughly.. Thanks a lot.

  • demonfox

    SSCertifiable

    Points: 6289

    I think I missed something .

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • Lokesh Vij

    SSChampion

    Points: 10836

    Nice question Kenneth...though I got it worng ๐Ÿ™‚

    Worth learning something..Thanks!

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • okbangas

    SSChampion

    Points: 11773

    Another reference: The -c parameter of sqlcmd.



    Ole Kristian Velstadbrรฅten Bangรฅs - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

  • Raghavendra Mudugal

    SSChampion

    Points: 10658

    Thank you Kenneth, Interesting one ๐Ÿ™‚

    I have selected the wrong answer, thinking either you change the script or query option, the change is compulsory. And later i read the question again, so came to know the query option change wouldn't matter, but just the script should not be modified.

    (In general, if a person parse the code then it will show error/s, so he has to take some careful steps to read the script and then change the query option to meet the script. If A has written the script and B is going to execute and B is not aware of the modified batch terminator and if B is trying to execute it via his machine with default settings, then A and B are going to have some pleasant conversation ๐Ÿ™‚ )

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • This was removed by the editor as SPAM

  • kaspencer

    SSCarpal Tunnel

    Points: 4257

    This question is illogical in structure.

    One cannot say "Can the following script be made to run ..." and then offer the choices True and False.

    For future reference, this type of question should be posed in one or other of the following ways, but not as it was originally posed.

    Either:

    "Can the following script be made to run ..."

    Yes No

    Or:

    "The following script can be made to run ..."

    True False

    Kenneth Spencer

    You never know: reading my book: "All about your computer" might just tell you something you never knew!
    lulu.com/kaspencer

  • Lokesh Vij

    SSChampion

    Points: 10836

    kaspencer (9/13/2012)


    This question is illogical in structure.

    One cannot say "Can the following script be made to run ..." and then offer the choices True and False.

    For future reference, this type of question should be posed in one or other of the following ways, but not as it was originally posed.

    Either:

    "Can the following script be made to run ..."

    Yes No

    Or:

    "The following script can be made to run ..."

    True False

    Kenneth Spencer

    +1

    The structure of the question needs conditioning.

    But honestly this can be ignored keeping in mind the knowledge it is checking ๐Ÿ™‚

    ~ Lokesh Vij


    Guidelines for quicker answers on T-SQL question[/url]
    Guidelines for answers on Performance questions

    Link to my Blog Post --> www.SQLPathy.com[/url]

    Follow me @Twitter

  • DugyC

    Hall of Fame

    Points: 3804

    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! ๐Ÿ˜€

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • zak_willis

    SSC Enthusiast

    Points: 105

    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.

  • Hugo Kornelis

    SSC Guru

    Points: 64645

    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/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • DugyC

    Hall of Fame

    Points: 3804

    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 :ermm:

    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 :doze:

    _____________________________________________________________________
    [font="Comic Sans MS"]"The difficult tasks we do immediately, the impossible takes a little longer"[/font]

  • Stuart Davies

    SSCoach

    Points: 18874

    Good question - thanks

    -------------------------------Posting Data Etiquette - Jeff Moden [/url]Smart way to ask a questionThere 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

Viewing 15 posts - 1 through 15 (of 83 total)

You must be logged in to reply to this topic. Login to reply