July 13, 2010 at 10:45 am
Excellent question!
I missed the semicolon and was bummed I chose the wrong answer because I didn't read all the SQL.
Code reading is a skill in which I should be proficient since I read and write code all day. Way back in the day I wrote in Oracle and when I moved to the SQL Server platform, it shocked me SQL Server 2000 didn't use semicolons. It took me a little while to unlearn semicolons and now it appears I completely ignore them. 😀
July 13, 2010 at 10:50 am
Jim Sleeman-388184 (7/13/2010)
Trick question! We shouldn't be testing syntax. What a waste of time!:angry:
I don't agree.
I got the question wrong because I missed the ; in the subquery. I thought it was something on my display until I took a closer look. If you code the way some people do, it is quite possible when doing a cut and paste, you might bring a ; over when you don't mean to. And since and error was a possible choice, I actually think checking for proper syntax is appropriate.
July 13, 2010 at 2:50 pm
I too missed it because I didn't notice the ;. I know that you can't put it there but didn't see it. I don't know if I would have noticed it had it been actual text instead of a graphic. (Especially when the graphic gets scaled down.)
July 13, 2010 at 6:57 pm
I am uncertain if this is a good question or not. The point was to error-check. We see that kind of mistake quite a bit in the forums (syntax errors - not necessarily a ";"). I think it helps to reinforce the need to closely evaluate the code - especially since many of us are trying to help others or even help ourselves to get better.
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
July 13, 2010 at 10:17 pm
thanks; was about to ask if there was any specific reason to mention SQL 2008...
kevin.l.williams (7/13/2010)
Thanks for the question. I learned something. I didn't know that Not ending Transact-SQL statements with a semicolon was on the Deprecated Database Engine Features in SQL Server 2008 R2.http://msdn.microsoft.com/en-us/library/ms143729.aspx
Thanks,
Kevin
July 14, 2010 at 12:44 am
Yup, missed the semicolon...
July 14, 2010 at 1:21 am
ziangij (7/13/2010)
was about to ask if there was any specific reason to mention SQL 2008...
As far as I can see, there wasn't. Semicolonms in subqueries have never been and will never be correct syntax.
The title of the question, mentioning a SQL Server version, mentioning default install, mentioning "the default Northwind database", and even the answers options - these factors all appear to be designed to drag our attention away from a syntax check toward an inspection of the functionality of the query. That gives me the feeling that the author of the question tried hard to minimize the correct answer ratio instead of concentrating on making the question a learning experience.
CirquedeSQLeil (7/13/2010)
I am uncertain if this is a good question or not. The point was to error-check. We see that kind of mistake quite a bit in the forums (syntax errors - not necessarily a ";"). I think it helps to reinforce the need to closely evaluate the code - especially since many of us are trying to help others or even help ourselves to get better.
Sure. But for questions posed in forums, the quesrtion submitter usually provides a copy of the code that you can copy/paste and then try yourself, and indicates in the question that there is some syntax error he/she can't figure out. They don't try actively try to hide the fact that there's asyntax error.
Dave62 (7/13/2010)
This was my first attempt at a QoD so my appologies if it was not up to par. I look forward to submitting more as I come accross various SQL puzzles in my daily work activities.
I know it takes a lot of time and effort to submit a question - and above all, a lot of couurage to face the feedback that will follow. I am glad that, in spite of the harsh critisicm given here (including mine), you have decided not to throw the towel, but to continue submitting questions. Creating questions is a learning experience in its own way. You'll see that your questions (and the feedback) will improve over time. (Allthough with this crowd, you'll probably never submit a question that everyone cheers for:-D)
Thanks for your effort, and I'm lookiing forward to your next contribution.
July 14, 2010 at 5:22 am
I have to admit that I got this correct, but for the wrong reason. In looking at the question
Using the default Northwind database on a default install of SQL Server 2008 SP1
, I figured that since the Northwind database is NOT part of a default install of SQL, that it would error out. With all the emphasis on the "default"s, I figured it was a trick question.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
July 14, 2010 at 7:15 am
Agreed, overlooked ';' : )
July 14, 2010 at 8:40 am
Hugo Kornelis (7/13/2010)
I got it wrong too. I was looking at the logic of the query and the subquery, not at all the fine punctuation details.Learned nothing from this question. This is the kind of error (typo) that people make now and then - and then the error message will quickly help you figure out what's wrong.
I don't mind questions about errors commonly made in T-SQL, or about errors that are hard to figure out due to how the parser presents the error. But I have never seen anyone use a semicolon in a subquery. And if someone does use it, the error message is clear: "Incorrect syntax near ';'." - and if you double-click the error message, you are taken to the line with the offending semicolon.
I hope the author will stop by and tell us what he/she was trying to teach us with this question. Maybe I missed the deeper issue here.
I totally agree.
July 14, 2010 at 9:34 am
How many DBA's execute their code without doing a Parse first?
July 14, 2010 at 9:40 am
WayneS (7/14/2010)
I have to admit that I got this correct, but for the wrong reason. In looking at the questionUsing the default Northwind database on a default install of SQL Server 2008 SP1
, I figured that since the Northwind database is NOT part of a default install of SQL, that it would error out. With all the emphasis on the "default"s, I figured it was a trick question.
You know when I was reading the question I was thinking the same thing, but then said no, that wouldn't be it...
July 15, 2010 at 12:38 am
It's a cheat question not worth the time one put on it.
Next time you could misspell a word, maybe a column name, and you'll get a even better query.
Don't waste our time, please.
July 15, 2010 at 7:15 am
This was one of those questions with no purpose. I too got it wrong because I even didn't look to author's syntax error. I was thinking why none of the replies were correct:) Damn then I should guess it was something like ajoke and mark the error. I wasn't really looking at these daily questions but today decided to. This was the 3rd one in questions and now I know that I was right not bothering to answer to questions.
July 17, 2010 at 4:27 pm
When I read the question, I can see the semi-colon doesn't belong there and it looks like an error in the question. Many of us come from visual basic, not c sharp. We can safely ignore semi-colons in visual basic. However, I see the point, learned something; I'm just not happy about it - seems more like a trick to me than anything else.
How many DBA's execute their code without doing a Parse first?
I hate that nasty green arrow. Sometimes I miss and hit that instead of execute. I never parse... that's for DBA's who are unsure of how to write queries (IMHO). I'm sure there are DBA's better than I who do parse. I do not parse.
Jamie
Viewing 15 posts - 31 through 45 (of 52 total)
You must be logged in to reply to this topic. Login to reply