INSERT INTO

  • If the choices are kept unchanged, then the statements should be something like:

    ...

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (1, 'cust 1', '(111) 111-1111', 'address 1');

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (2, 'cust 2', '(222) 222-2222', 'address 2');

    INSERT INTO dbo.Cuss2( cid, cut, ph, adx)

    VALUES (2, 'cust 2', '(222) 222-2222', 'address 2');

    GO

    -- Second SELECT Statement

    SELECT COUNT(cut) AS 'Count from Cuss 2' FROM dbo.Cuss2

    This was probably what the author intended , if you compare the inserts into dbo.Cuss1 and into dbo.Cuss2.

  • Agreed. But given the code as provided there was a valid set of answers. The second set of inserts would insert two records, both successfully inserting and failing to insert a row, and the second select would give a count of 1, so neither 0 or 2 would be correct. There needs to be better proofing of QOD.

  • Weird. I gave the wrong answer ( error, error, 0 ) and scratched my head trying to figure out what was wrong.

    Then after my first coffee I suddenly noticed the words:

    What happens in this code snippet? Select 4 answers.

    Oops! That should have given me (us) a clue that something was wrong. 😉


    Dutch Anti-RBAR League

  • Fortunately I got 2 points.

    The second count gives 1 but as there was no 1 in the answer hence selected 2 and got it correct.

    In QOD we have to make assumptions also apart from correct answer. 😛

    ---------------------------------------------------
    "Thare are only 10 types of people in the world:
    Those who understand binary, and those who don't."

  • When answering I could see it was likely the QOD poser made a mistake and what the possible intended answer was. It was also possible it was a trick question - so that the final count was 1. Would that our computer systems be able to figure out such quandaries.

  • jbwa

    it was likely the QOD poser made a mistake

    An incorrect assumption. If you had taken the time to read this entire forum you would have learned that the question was modified by Steve Jones, and is so doing he made a mistake.

    So the original poster (myself) did NOT make the mistake.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • I only could find 3 correct answers among the choices presented, for second select statement count is neither 0, nor 2, but 1!!!

    So, let me join all, who knew the right answers, but didn't get a chance to show it. We all have to get our 2 points back:w00t:

  • The second Seelct returns "1".

    I've answered with the following:

    - 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

    - First select statement returns a count of 0

    as there is one insert in dbo.cuss2 that does not generate an error message.

    I've answered the only four possible correct answers.

    So, please award me my points.

  • The second select statement will return 1,becoz its fails in primary key constraint

  • LOL... This has to be the longest running QOTD discussion ever.

  • Do you think we can keep it going until Christmas?

  • SanDroid (9/26/2011)


    LOL... This has to be the longest running QOTD discussion ever.

    Getting there... mine had over 110 iirc.

  • Ninja's_RGR'us (9/26/2011)


    SanDroid (9/26/2011)


    LOL... This has to be the longest running QOTD discussion ever.

    Getting there... mine had over 110 iirc.

    Actually it's 201!

    http://www.sqlservercentral.com/Forums/Topic1144668-1198-1.aspx

  • Ninja's_RGR'us (9/26/2011)


    Ninja's_RGR'us (9/26/2011)


    SanDroid (9/26/2011)


    LOL... This has to be the longest running QOTD discussion ever.

    Getting there... mine had over 110 iirc.

    Actually it's 201!

    http://www.sqlservercentral.com/Forums/Topic1144668-1198-1.aspx

    I remeber that one well, but in that one you said up front in the initial QOTD author post that this was an uncommon question that you expected a lot of Backlash Posts over.

  • SanDroid (9/26/2011)


    Ninja's_RGR'us (9/26/2011)


    Ninja's_RGR'us (9/26/2011)


    SanDroid (9/26/2011)


    LOL... This has to be the longest running QOTD discussion ever.

    Getting there... mine had over 110 iirc.

    Actually it's 201!

    http://www.sqlservercentral.com/Forums/Topic1144668-1198-1.aspx

    I remeber that one well, but in that one you said up front in the initial QOTD author post that this was an uncommon question that you expected a lot of Backlash Posts over.

    Sh*t happens. The question wasn't designed especially for that, but I expected it.

    This one is just a small typo by Steve... and it keeps on going.

    Apparently people like learning, but love complaining more :-D.

Viewing 15 posts - 91 through 105 (of 122 total)

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