Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Are we in all these cities?


Are we in all these cities?

Author
Message
franp-424154
franp-424154
SSC-Enthusiastic
SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)SSC-Enthusiastic (173 reputation)

Group: General Forum Members
Points: 173 Visits: 626
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. :-D
Lynn Pettis
Lynn Pettis
SSC-Insane
SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)SSC-Insane (24K reputation)

Group: General Forum Members
Points: 24227 Visits: 37978
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.

Cool
Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
UMG Developer
UMG Developer
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2280 Visits: 2204
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.)
SQLRNNR
SQLRNNR
SSC-Insane
SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)SSC-Insane (21K reputation)

Group: General Forum Members
Points: 21093 Visits: 18259
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

ziangij
ziangij
SSCrazy
SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)SSCrazy (2.9K reputation)

Group: General Forum Members
Points: 2910 Visits: 374
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

mackie
mackie
SSC Rookie
SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)SSC Rookie (33 reputation)

Group: General Forum Members
Points: 33 Visits: 219
Yup, missed the semicolon...
Hugo Kornelis
Hugo Kornelis
SSCrazy Eights
SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)SSCrazy Eights (8.3K reputation)

Group: General Forum Members
Points: 8329 Visits: 11580
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.


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
WayneS
WayneS
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6241 Visits: 10403
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
If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
Links: For better assistance in answering your questions, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings

richard.kull
richard.kull
Grasshopper
Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)Grasshopper (11 reputation)

Group: General Forum Members
Points: 11 Visits: 46
Agreed, overlooked ';' : )
forjonathanwilson
forjonathanwilson
Valued Member
Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)Valued Member (69 reputation)

Group: General Forum Members
Points: 69 Visits: 33
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search