Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

Are we in all these cities? Expand / Collapse
Author
Message
Posted Tuesday, July 13, 2010 10:45 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Sunday, November 06, 2011 4:55 PM
Points: 173, Visits: 617
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.
Post #951663
Posted Tuesday, July 13, 2010 10:50 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 6:52 PM
Points: 22,492, Visits: 30,197
Jim Sleeman-388184 (7/13/2010)
Trick question! We shouldn't be testing syntax. What a waste of time!



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.



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)
Post #951666
Posted Tuesday, July 13, 2010 2:50 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, March 27, 2014 8:50 AM
Points: 2,163, Visits: 2,184
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.)
Post #951826
Posted Tuesday, July 13, 2010 6:57 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 10:42 AM
Points: 20,460, Visits: 14,086
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


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #951943
Posted Tuesday, July 13, 2010 10:17 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 2:13 AM
Points: 1,865, Visits: 368
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
Post #951990
Posted Wednesday, July 14, 2010 12:44 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, June 18, 2012 4:11 AM
Points: 27, Visits: 219
Yup, missed the semicolon...
Post #952077
Posted Wednesday, July 14, 2010 1:21 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 3:49 PM
Points: 5,794, Visits: 8,007
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)

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
Post #952097
Posted Wednesday, July 14, 2010 5:22 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:57 AM
Points: 6,544, Visits: 8,759
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
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
Post #952191
Posted Wednesday, July 14, 2010 7:15 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, April 09, 2014 12:37 PM
Points: 11, Visits: 24
Agreed, overlooked ';' : )
Post #952305
Posted Wednesday, July 14, 2010 8:40 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Tuesday, September 14, 2010 8:24 AM
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.
Post #952400
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse