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 12345»»»

How many Records Will Get Selected Expand / Collapse
Author
Message
Posted Thursday, June 10, 2010 8:27 PM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Friday, September 03, 2010 4:19 AM
Points: 158, Visits: 72
Comments posted to this topic are about the item How many Records Will Get Selected
Post #935807
Posted Thursday, June 10, 2010 10:44 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 3:57 AM
Points: 2,570, Visits: 4,655
Another Trick Question that is sure to generate quite a bit of debate. You dont learn anything new, and lose 3 points. I am sure many would be knowing the answer but will choose the wrong option because of the construction of the question. I would suggest to put such questions under a different criteria called TRICK QUESTION or something so that people dont feel fooled.


Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #935827
Posted Thursday, June 10, 2010 11:25 PM


SSC-Insane

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

Group: General Forum Members
Last Login: Yesterday @ 10:05 PM
Points: 20,485, Visits: 14,144
I don't see this as a trick question. I see it as a good question. There is something to be learned from this question and thus it is worthwhile.

Thanks for the QOD.




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 #935836
Posted Thursday, June 10, 2010 11:54 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Wednesday, March 12, 2014 3:59 AM
Points: 1,938, Visits: 1,149
Hi i know this answer it was syntax wrong but i put 1 as wrong anwer.

because i thought that there may wrong with script.I know that this script will give sytax error.But i thought that there is some print mistake.

then i correct it to.

Alter table mytable with check Add constraint[checkmainvalue] check(([mainvalue])> (0))

then executed.this gives me 1 as result.because the conditon satisfied for 1 only.

This question is not difficulty.it divorsed me to put wrong anwer.There is nothing new learn from this question.


Malleswarareddy
I.T.Analyst
MCITP(70-451)
Post #935840
Posted Friday, June 11, 2010 1:01 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 7:19 AM
Points: 2,814, Visits: 3,851
Hm, looks like I misinterpreted the intention of the author.
My assumption was, that the question was about whether an error in one of the INSERT operations aborts the full batch. I did see the missing parentheses, but since there have been so many erroneous questions in the past, I also considered this one to be an error of the author.
Well, better luck next time...



Best Regards,
Chris Büttner
Post #935855
Posted Friday, June 11, 2010 1:01 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 1:39 AM
Points: 2,397, Visits: 2,287
There is nothing new learn from this question.

The lesson is:
"GO" may be dangerous if no error checking is done!
Post #935856
Posted Friday, June 11, 2010 2:06 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 3:57 AM
Points: 2,570, Visits: 4,655
CirquedeSQLeil (6/10/2010)
I don't see this as a trick question. I see it as a good question. There is something to be learned from this question and thus it is worthwhile.

Thanks for the QOD.


I agree there may be some who might learn something from the question. A definite good question for them no doubt. But i thought the question had a typo and selected the wrong answer. How do i know if the syntax error was deliberate or just a mistake? We have had instances in the past where it was just a typo.

The first thing i do when i come to office is open my SSMS and then SSC QOTD. And when something like this happens it definitely irritates you a bit. Same happened with me.



Kingston Dhasian

How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
Post #935867
Posted Friday, June 11, 2010 2:09 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 1:48 PM
Points: 5,802, Visits: 8,019
I do not like this kind of question at all. The QotD should be a learning opportunity, with clear questions and no tricks.

There is nothing to be learned from this question. In a real situation, the error in the syntax would be obvious as soon as the code is executed, and it would be corrected before users get to add data.

The lesson is:
"GO" may be dangerous if no error checking is done!

If that was the intended lesson, then the example is very badly chosen. Come on! How realistic is a script that adds a constraint and then immediately adds some data that obviously violates that constraint. I can only envisage that in a test database, where someone wants to test if constraints work as expected (not a bad idea, especially if NULL values are involved) - but in that case, checking the test output would immediately expose the problem and allow the developer to correct it. Which is the very purpose of running a test script.

Another problem I have is that this kind of questions call for psychic powers on our part. Others have already commented that it might have been a honest mistake by the author, and we are suppose to answer based on a succesfull constraint creation (such errors and expectation have occured in the past).
A problem not yet pointed out, but relevant in this and many other questions, is case sensitivity. Even if the missing parentheses are added, the constraint would still not be created in my test database, since I run a case sensitive collation (so "mytable" is not the same as "MyTable"). Other people will use different collations, and hence get a different result. How am I suppose to know what the author had in mind?

This all being said, I'd still like to say "thank you" to bazzkar for contributing this question. Please take my reaction as it's intended, as constructive feedback. Don't let it discourage you from contributing more questions in the future, but do keep the feedback in mind to make your future questions better.



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #935868
Posted Friday, June 11, 2010 2:18 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: 2 days ago @ 7:53 AM
Points: 1,659, Visits: 6,008
Well I learnt something, though probably not what was intended.

Believe it or not, I never realised that identity columns are ignored if you could insert into a table using that syntax, ie not giving a column list. I've always coded such things as
insert into MyTable (mainvalue) values (-1)
on the assumption that otherwise it would give an error about fewer values than columns!
Post #935872
Posted Friday, June 11, 2010 3:35 AM
SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 2:26 PM
Points: 5,850, Visits: 12,599
Its a trick question that encourages people to just cut and paste and see what happens.

the question appears to be on how constraints work but is in effect testing your knowledge of syntax (or ability to cut and paste). Who remembers all details of syntax?


---------------------------------------------------------------------

Post #935899
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse