September 14, 2011 at 2:01 am
I agree with what the question was trying to show, however I believe the answers were wrong for the following reason (and you could select 4). Both inserts will generate an error message, however the second one will succeed on the first row, while the first fails as a complete transaction, hence count 0 for first table, and 1 for second table.
Either the answer should be that the second select returns 1, or the second insert will succeed as well as fail.
I also think that what probably happened is that the second insert was miss-copied! If you look at the first statement you have cid of 1 , 2 and 2, while the second table has 1, 1 and 1 (lazy copy/paste). If the inserts were meant to try insert the same data into both tables, then there would have been 2 rows in the second table.
That said, we need to get our points back - particularly since the question asks for 4 answers and there are possibly 5...
September 14, 2011 at 2:01 am
Beaten to it. :laugh:
There are only three correct answers but the question has emphasized a very good point with regards to the insertion of multiple values in SQL2008.
September 14, 2011 at 3:01 am
A good question, unfortunately it came down to "guess the typo". Fortunately I guessed right that the values inserted into cuss2 were supposed to be the same as those inserted into cuss1.
September 14, 2011 at 3:29 am
Second Insert Statement will give 1 count as the Primary Key is there on CID. At the time of insertion, It will only insert the first record, for second and third it will throw error....
September 14, 2011 at 3:36 am
440692 I am just a number (9/14/2011)
Thanks, good question.It nicely highlights the difference between the two insert statements.
I appreciate the time & effort you took with the question
Really, its a very good question and nice way of representation.
Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
September 14, 2011 at 5:07 am
Hi,
where're correct answers? 😉
Tx
September 14, 2011 at 5:17 am
I agree that it's a great question and I thank the author for it but could you please correct the code and allow us to answer it again? Maybe you could change it a little to have different answers? 🙂
Best regards,
Best regards,
Andre Guerreiro Neto
Database Analyst
http://www.softplan.com.br
MCITPx1/MCTSx2/MCSE/MCSA
September 14, 2011 at 5:30 am
I believe that the second select statement will return 1 instead of 0 or 2.
September 14, 2011 at 5:42 am
Awesome question.
And TIA for the points back :-D.
Notice how I'm definitely not throwing the first stone here 😛
September 14, 2011 at 5:43 am
bitbucket-25253 (9/13/2011)
If everything seems to be going well, you have obviously overlooked something.Ron
So this sig was written 2 years ago for specifically this moment. Nice forethought :hehe:
September 14, 2011 at 5:45 am
The second select doesn't return 2... It returns 1.
What is it???
September 14, 2011 at 5:47 am
I selected the right answers even though it was wrong. The second select returns 1 row, not 2.
http://brittcluff.blogspot.com/
September 14, 2011 at 5:48 am
Lady Di (9/14/2011)
The second select doesn't return... It returns 1.What is it???
Yes it does. I'm guessing the PK sequence is wrong in the 2nd insert series, hence the incorrect correct answer selected. Or the correctly incorrect answer to a grammatically correct question. or
/stackoverflow
September 14, 2011 at 5:51 am
The second select doesn't return 2... It returns 1.
What is it???
September 14, 2011 at 5:53 am
Lady Di (9/14/2011)
The second select doesn't return 2... It returns 1.What is it???
There's a small typo in the question. Happens sometimes.
Steve will awards points back whenever he gets up this morning.
Viewing 15 posts - 16 through 30 (of 122 total)
You must be logged in to reply to this topic. Login to reply