INSERT INTO

  • Toreador (9/14/2011)


    sanbornd (9/14/2011)


    How many points do you lose for posting a question with the wrong answer? How about the sum of all the wrong answer.

    Good idea.

    But how many points should people lose for posting a "question is wrong" reply when dozens of people have already done exactly the same? Maybe one point per previous reply? 😉

    Everyone should be allowed to post one "question is wrong" reply each on a question that is incorrect. This will give them 1 point to either (a) make up for the point they missed by getting a "wrong answer" mark, or (b) keep as a bonus if they were smart or lucky enough to guess what the question author was thinking.

    This would also have the benefit of saving the good folks at SSC the bother of having to "award back" points for bad questions. Just do your one post, and you're back to even. Better yet, come up with some useful information relevant to the question, and start comments going back and forth.

  • Toreador (9/14/2011)


    sanbornd (9/14/2011)


    How many points do you lose for posting a question with the wrong answer? How about the sum of all the wrong answer.

    Good idea.

    But how many points should people lose for posting a "question is wrong" reply when dozens of people have already done exactly the same? Maybe one point per previous reply? 😉

    If you can't handle the heat of discussion about content you post on the internet then don't submit it. If you make a mistake in front of a thousand people, do not be suprised when more than one of them cry foul.

    Nobody should experiance any loss for posting personal views in an open forum that asks for comments.

    Soliciting an open disccussion and then punishing people for actually participating in that discussion? :sick:

  • SanDroid (9/14/2011)


    Toreador (9/14/2011)


    sanbornd (9/14/2011)


    How many points do you lose for posting a question with the wrong answer? How about the sum of all the wrong answer.

    Good idea.

    But how many points should people lose for posting a "question is wrong" reply when dozens of people have already done exactly the same? Maybe one point per previous reply? 😉

    If you can't handle the heat of discussion about content you post on the internet then don't submit it. If you make a mistake in front of a thousand people, do not be suprised when more than one of them cry foul.

    Nobody should experiance any loss for posting personal views in an open forum that asks for comments.

    Soliciting an open disccussion and then punishing people for actually participating in that discussion? :sick:

    Thts perfectly written

    Regards
    Sushant Kumar
    MCTS,MCP

  • Yay - I got it right 🙂

    By getting it wrong :crazy:

    The answer for the second select is not 2

    Steve Jimmo
    Sr DBA
    “If we ever forget that we are One Nation Under God, then we will be a Nation gone under." - Ronald Reagan

  • SanDroid (9/14/2011)[hrIf you can't handle the heat of discussion about content you post on the internet then don't submit it. If you make a mistake in front of a thousand people, do not be suprised when more than one of them cry foul.

    Nobody should experiance any loss for posting personal views in an open forum that asks for comments.

    Soliciting an open disccussion and then punishing people for actually participating in that discussion? :sick:

    The problem with a squillion identical "this is wrong" posts isn't that it upsets the question setter, but that it hides genuinely useful discussion in a sea of "me too"s. As indeed does this reply.

    P.S. You obviously didn't notice the 😉 - I wasn't making a serious suggestion :-D:-);-):w00t::hehe:

    [Edit: korect deliferate speling mistale]

  • The count for the second SELECT is zero because of the nature of the insert. The three separate INSERTs each have a CID of 1, so only the first one will be added to the table, which means the count can only be one. If you intended for one of those keys to be a two as in the first example, then a count of two would be appropriate. My suspicion is that the error is a typo, just as much of the rest of the spelling would indicate. I also would like my points back if any are docked.

  • This problem with the question is entirely my fault, not Ron's. I copied over the code, making a mistake after testing it when I was correcting formatting. The second set of inserts should have inserted PKs of 1, 2, 2, so that the result was two.

    I have corrected the code, and also awarded back points to this point in time.

    My apologies.

  • Toreador (9/14/2011)


    SanDroid (9/14/2011)[hrIf you can't handle the heat of discussion about content you post on the internet then don't submit it. If you make a mistake in front of a thousand people, do not be suprised when more than one of them cry foul.

    Nobody should experiance any loss for posting personal views in an open forum that asks for comments.

    Soliciting an open disccussion and then punishing people for actually participating in that discussion? :sick:

    The problem with a squillion identical "this is wrong" posts isn't that it upsets the question setter, but that it hides genuinely useful discussion in a sea of "me too"s. As indeed does this reply.

    P.S. You obviously didn't notice the 😉 - I wasn't making a serious suggestion :-D:-);-):w00t::hehe:

    [Edit: korect deliferate speling mistale]

    LOL... I noticed. I have also noticed that some would rather discuss things that are off topic of the QOTD. Posts about too many posts about the question being wrong are slightly off topic.

    The people you mention are making posts about today's QOTD.

    Our posts are the off topic ones that should not be counted or given points. 😎

  • The second select returns 1 row. Your available answers don't have that as an option.

  • I am adding my voice to the choir of those who say that the expected answer '2' is wrong.

    Bitbucket, have you test this code?

  • Steve Jones - SSC Editor (9/14/2011)


    This problem with the question is entirely my fault, not Ron's. I copied over the code, making a mistake after testing it when I was correcting formatting. The second set of inserts should have inserted PKs of 1, 2, 2, so that the result was two.

    I have corrected the code, and also awarded back points to this point in time.

    My apologies.

  • Thank you, obviously many of us struggled to get an incorrect answer since there were four correct answers for the code as delivered.

  • codebyo (9/13/2011)


    I couldn't find 1 as the correct answer for the second SELECT so I chose the four options below:

    - Insert into table dbo.cuss1 generates an error msg

    - Insert into table dbo.cuss2 generates an error msg

    - Insert into table dbo.cuss2 does NOT generate an error msg (the first INSERT statement doesn't generate any errors)

    - First select statement returns a count of 0

    So my answer should be right, right?

    Can I have my two points back please? 😛

    Best regards,

    Agreed. These are the only four answers that describe results that all occur when executing the T-SQL presented. The INSERT INTO dbo.cuss1 statement returns an error because the third set of values violates the primary key constraint. The entire statement is rolled back, and no rows are inserted, so the subsequent SELECT COUNT(cut) from dbo.Cuss1 returns 0.

    With no information to the contrary provided, the only justifiable assumption about transaction management mode is that SQL Server is running in the default Autocommit mode, in which "[e]very Transact-SQL statement is committed or rolled back when it completes." http://msdn.microsoft.com/en-us/library/ms187878.aspx Therefore, the first INSERT INTO dbo.Cuss2 commits when it completes, 1 row is inserted, and this statement does not generate an error message, and "Insert into table dbo.cuss2 does NOT generate an error msg" is a correct answer. The second and third INSERTS fail because they violate the primary key constraint, so "Insert into table dbo.cuss2 generates an error msg" is also correct. Those two INSERTs are rolled back, so only 1 row exists in dbo.Cuss2, and SELECT COUNT(cut) from dbo.Cuss2 returns 1.

    Points should be awarded for answers that are correct based on the question as presented. We shouldn't have to assume that the question writer made a typo and answer based on what we think the question writer meant. If that were the case, where should we assume the typo occurred? Should we assume that the answer that says "The second SELECT statement returns a count of 2" should say "The second SELECT statement returns a count of 1", making it correct? Or should we assume that the answer that says "The second SELECT statement returns a count of 0" should say "The second SELECT statement returns a count of 1", making it correct? Or should we assume that the second INSERT INTO dbo.Cuss2 statement should have a value of 2 for column cid, thus avoiding the primary key violation and making "The second SELECT statement returns a count of 2" a literally correct answer? If we make any of these assumptions about what the question writer meant, then there are FIVE correct answers, because the INSERT INTO dbo.Cuss2 statements still result in at least one successful commit and at least one error message/rollback.

    To put it as simply as possible, points should be awarded for answering the question based on what it ACTUALLY SAYS, not on what the question writer MEANT TO SAY BUT DIDN'T!

    Jason Wolfkill

  • If the code had been delivered correctly there would have been 5 correct answers. Both cuss1 and cuss2 had insert errors, but cuss2 had (1 or 2) successes that did not generate an error, the finally either 1 or 2 of the select statements were true. In the case of the delivered code that equals 4 correct answers and 5 correct answers for the intended code.

  • Steve Jones - SSC Editor (9/14/2011)


    This problem with the question is entirely my fault, not Ron's. I copied over the code, making a mistake after testing it when I was correcting formatting. The second set of inserts should have inserted PKs of 1, 2, 2, so that the result was two.

    I have corrected the code, and also awarded back points to this point in time.

    My apologies.

    So how do we know we got our points? At this point, when I navigate to this QotD, I still see "Sorry - You got it wrong" and the code still looks like the old version. Do you just add the points to our totals directly or change the result of our answer? Thanks, Steve!

    Jason Wolfkill

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

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