December 4, 2012 at 6:45 am
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.
December 4, 2012 at 7:04 am
This was removed by the editor as SPAM
December 4, 2012 at 7:11 am
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
December 4, 2012 at 7:22 am
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. 😉
December 4, 2012 at 7:34 am
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
December 4, 2012 at 8:22 am
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? 🙂
December 4, 2012 at 8:27 am
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.
December 4, 2012 at 9:03 am
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.
December 4, 2012 at 10:13 am
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,
December 4, 2012 at 10:27 am
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.
December 4, 2012 at 10:31 am
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.
December 4, 2012 at 10:36 am
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.
December 4, 2012 at 12:39 pm
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.
December 4, 2012 at 1:51 pm
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
December 4, 2012 at 7:24 pm
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