SET Options - 2

  • Hugo Kornelis (12/4/2012)


    I had to make a guess as to the author's intention and preparation.

    Did he actually try the code himself? In that case, it is a nasty trick question, because everything in the question distracts from the syntax error (semicolon after GO) that causes the batch to fail and the table to not be created.

    Of did he forget to execute the code? In that case, it is an unintended trick question, because I can assume that the semicolon after the GO was an oversight and the author wanted us to focus on the ability to create a table name using reserved words (not a recommended good practice, by the way).

    ...

    Another possibility is that Ron did in fact try the code but then added the semicolon when submitting the question to SSC without re-testing. Possibly a good lesson here about minor touch up editing without testing.

  • This was removed by the editor as SPAM

  • My apologies to all .....

    1. I did test the code multiple times ...

    2. When testing the ; was NOT present.

    3. I can only guess, but was using a brand new lap top when submitting the question and typing the QOD rather than a cut and paste from SSMS, and somehow or other I pressed the semi-colon key.

    4. Poor excuse on my part for the error so let me say again:

    My apologies to all

    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]

  • bitbucket-25253 (12/4/2012)


    My apologies to all .....

    1. I did test the code multiple times ...

    2. When testing the ; was NOT present.

    3. I can only guess, but was using a brand new lap top when submitting the question and typing the QOD rather than a cut and paste from SSMS, and somehow or other I pressed the semi-colon key.

    4. Poor excuse on my part for the error so let me say again:

    My apologies to all

    We're all human Ron. Apology not needed but certainly accepted. 😉

  • okbangas (12/3/2012)


    Wrong answer marked as correct. SQL Server will return the following error message:

    Msg 102, Level 15, State 1, Line 5

    Incorrect syntax near ';'.

    Semicolon is not allowed after go.

    So hard to tell why anyone would post a QOTD without actualy running the SQL....

    :crazy:

    Of course like Hugo said...

    had I looked at who posted the question I would have known....:-P

  • bitbucket-25253 (12/4/2012)

    3. I can only guess, but was using a brand new lap top when submitting the question and typing the QOD rather than a cut and paste from SSMS, and somehow or other I pressed the semi-colon key.

    Are programmers (including the ones who write SQL code) the only people who think retyping something is less hassle than cut and paste, I wonder? 🙂

  • Hugo Kornelis (12/4/2012)


    I picked the wrong option. If I had checked the submitter of the question, I probably would have picked the right option - I don't think I ever saw an intentional trick question from Ron.

    I did see Ron was the submitter and I still picked the wrong option. I thought to myself, "It's not like him to write an intentional trick question but it's not like him to create a blatent typo either." Other than this snag, I liked the question.

  • Hugo Kornelis (12/4/2012)


    I had to make a guess as to the author's intention and preparation.

    Did he actually try the code himself? In that case, it is a nasty trick question, because everything in the question distracts from the syntax error (semicolon after GO) that causes the batch to fail and the table to not be created. . . .

    I did not expect a trick question from Ron and the rest was easy.

    Thanks, Ron.

  • I picked the right answer because I did think the semicolon was a typo from Ron.

    Great question about options, but keep in mind that naming DB objects with reserved words is not a good practice.

    Saludos,

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • I get this if I run the script.

    Msg 102, Level 15, State 1, Line 8

    Incorrect syntax near 'GO'.

    If I remove the semi-colon from the GO, it works.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (12/4/2012)


    I get this if I run the script.

    Msg 102, Level 15, State 1, Line 8

    Incorrect syntax near 'GO'.

    If I remove the semi-colon from the GO, it works.

    BLAH! Why can't I ever read question writers minds?

    Too often the surprise questions leave me sitting there going... did he mean for the ; to throw the error or not.

    Obviously now it's that he didn't mean for that. Of course I had to guess which way his devious mind was going.

    Steve should at least fix the question for the later comers.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • BLAH! Why can't I ever read question writers minds?

    Too often the surprise questions leave me sitting there going... did he mean for the ; to throw the error or not.

    Obviously now it's that he didn't mean for that. Of course I had to guess which way his devious mind was going.

    Steve should at least fix the question for the later comers.

    Sad to have to ferret out the syntax typos and get to question the author meant. Sometimes the syntax errros are the question and sometimes not?? And I'm a bad guesser.

  • ma-516002 (12/4/2012)


    Got it wrong, because I thought it is a trick question since "GO;" will throw an error and the table will not be created.

    Agreed. If the SQL is executed with the semi-colon an error will be thrown and the table will not be created.

  • Great question Ron, thanks!

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Thanks Ron.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 15 posts - 16 through 30 (of 40 total)

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