Inserts

  • Lynn Pettis (8/23/2012)


    Why is everyone calling it a trick question? It started with (0), it is a valid value.

    Lots of people overlooked that, thinking 1,000 values, 1,000 limit. I'd agree with you. It would be easy to get a 0 in there.

    I suppose it could have been 1..1001 and tested the same thing.

  • Steve Jones - SSC Editor (8/23/2012)

    I suppose it could have been 1..1001 and tested the same thing.

    1001 is an odd (literally :-P) upper value, though--it would immediately make people suspect there was something significant about the number 1000 the author was trying to avoid.

  • sknox (8/23/2012)


    The question included a very specific error message as your only failure option, which was clearly not related to the (non)existence of a table. You happened to get it right because you didn't read that error message carefully. There are always going to be those who don't read the question carefully. Some will get credit they don't deserve, and some will not get credit they should have. That does not reflect on the quality of the question, in my book.

    This question provided all of the information necessary for someone who knew the subject being tested to be able to answer it correctly. The answer provided a good explanation and valid references. That, to me, is the hallmark of a good question.

    *sigh* I guess we'll just disagree here. A well written question should have avoided what to me is a very obvious false positive.

    When I saw

    S : Query ran successfully

    E : Error in Query , Maximum Number of Row Value Expressions reached

    All I saw was

    S : Query ran successfully

    E : Error in Query , "blah blah blah about error message"

    When I read the question, I saw a blatent error. Missing objects for the inserts to work on. The subject was Inserts, not row constructor limitations of Insert.

    Seeing that S was impossible the result had to be E.

    If the table definitions had been up there... instead of immediately going for the error, I'd have had to think, and instead of a false positive, I'd either have gotten it wrong because I forgot about the 1000 row limitation or right because I remembered what you were stressing with the question.

    I got it right anyway... so I guess I shouldn't complain, but I'd call my criticism valid.



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (8/23/2012)


    *sigh* I guess we'll just disagree here

    Hmmm, I'd rather say that you are agreeing vehemently!

    sknox writes: >>You happened to get it right because you didn't read that error message carefully.<<

    Then you write: >>All I saw was (...) Error in Query , "blah blah blah about error message"<<

    Which proves exactly the point sknox was making: that you didn't read the error message carefully.

    This time, you were lucky - by not reading all parts of the question carefully, you just happened to stumble upon the right answer. With mutliple choice questions, that will always happen.

    I don't think this is valid critisicm on the question. All the information was there; you chose not to read the error message carefully.

    I do think that starting at zero makes the question trickier than it should have been. (Note that I am not calling the question a trick question; I'm calling it tricky, which is not the same). If the goal of the question author was to test our knowledge of the upper limit of values in an INSERT VALUES statement against permanent and temporary tables and table variables, then I see no need to make it completely obvious that the number of values was OVER 1,000. Than, the question would really have focussed on that bit of knowledge.

    That being said, I got it wrong for the simple reason of not knowing these limits at all. And I'll probably forget them again before the end of the day. I really hope nobody will ever write code that comes even near those limits.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • Hugo Kornelis (8/23/2012)


    Which proves exactly the point sknox was making: that you didn't read the error message carefully.

    This time, you were lucky - by not reading all parts of the question carefully, you just happened to stumble upon the right answer. With mutliple choice questions, that will always happen.

    So what purpose did leaving out the table create statements or saying that we have to assume that they exist in the text prior to the code serve?



    --Mark Tassin
    MCITP - SQL Server DBA
    Proud member of the Anti-RBAR alliance.
    For help with Performance click this link[/url]
    For tips on how to post your problems[/url]

  • mtassin (8/23/2012)

    All I saw was

    S : Query ran successfully

    E : Error in Query , "blah blah blah about error message"

    Wow, have you considered vision corrective lenses?

    (Forgive me, I can't resist being a wise-guy today.)

  • mtassin (8/23/2012)


    So what purpose did leaving out the table create statements or saying that we have to assume that they exist in the text prior to the code serve?

    I don't know the purpose, you'd have to ask the question's author.

    The benefit of leaving that out is that it helps the readers focus on the actual issue being tested.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/

  • good question - 74% wrong so far and not because of wording or trickery this time.

    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

  • Sometimes you have to make assumptions. We do that every day because we don't live in a perfect world that provides us with 100% of the information we need to make a decision.

  • Good question, didn't know about the limits of an INSERT, good to learn, though I think it is not that often used in production.

    "El" Jerry.

    "A watt of Ottawa" - Gerardo Galvan

    To better understand your help request, please follow these best practices.[/url]

  • Hugo Kornelis (8/23/2012)


    mtassin (8/23/2012)


    So what purpose did leaving out the table create statements or saying that we have to assume that they exist in the text prior to the code serve?

    I don't know the purpose, you'd have to ask the question's author.

    The benefit of leaving that out is that it helps the readers focus on the actual issue being tested.

    Definitions for all objects, I thought it's a fair assumption when a specific Error message has been mentioned. The note was added to make sure , it is all about inserting rows,sequentially.

    Also,on searching the error , msdn page is within the reach.

    ~ demonfox
    ___________________________________________________________________
    Wondering what I would do next , when I am done with this one :ermm:

  • This one almost got me, I actually ran over the 1000 row limit once because I was trying to throw values from a spreadsheet into a table and didn't feel like actually importing it.

    I created my values list in the Excel file that was given to me and then copied and pasted it into SSMS and was surprised when it wouldn't load them all. I think it was about 2500 records. This was right after I first found out about using the INSERT INTO <table> VALUES (),(),(),... syntax, since SQL 2008 was new at the time, so that was my new fun way of loading records. Since then, any list I get that has more than about 100 records gets imported via SSMS or SSIS.

    Nice reminder question, thanks!

  • Got it right after a lot thinking, cause I looked the question wrongly. I saw 1000, 8060 and 65365 all of a sudden I took the data type in to the consideration and was checking their limits. When I saw the S and E explained and the words Row expansion - that made me to change my view on the questions objective. 😀

    Nice question; Thank you demonfox.

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • I don't answer a lot of quiz question, but sometimes I cut and paste the SQL and play with it when I have a chance.

    I like when the question has the table definition, though it wasn't necessary here.

    I hope quizzes like this don't encourage people to get fancy with their DML statements. It is better in production to just do 1001 insert statements.

  • Nice question and debate. I too got it wrong as I missed the '0' but guess I have learnt something (read more closely!!)

Viewing 15 posts - 46 through 60 (of 62 total)

You must be logged in to reply to this topic. Login to reply