SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Predict output


Predict output

Author
Message
Steve Jones
Steve Jones
SSC Guru
SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)SSC Guru (327K reputation)

Group: Administrators
Points: 327669 Visits: 20091
The answer is arguably correct since an exception occurs and is handled in the code. The order of what appears, and where, depends on your client.

The question has been edited to separate out "results" and "messages"

Follow me on Twitter: @way0utwest
Forum Etiquette: How to post data/code on a forum to get the best help
My Blog: www.voiceofthedba.com
srinivas.thadem
srinivas.thadem
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
Points: 10 Visits: 2
I really disagrree with the answer 1245.
the actual resul it is 12345.
if @i = 3 then we are setting J = @i/0;

so there no use of this statement finally we are storing the i value in to the temparory table.
Fatal Exception Error
Fatal Exception Error
Old Hand
Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)Old Hand (345 reputation)

Group: General Forum Members
Points: 345 Visits: 386
srinivas.thadem (2/2/2010)
I really disagrree with the answer 1245.
the actual resul it is 12345.
if @i = 3 then we are setting J = @i/0;

so there no use of this statement finally we are storing the i value in to the temparory table.


You can't divide by 0.... unless your name is Chuck Norris.
Peter Trast
Peter Trast
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1732 Visits: 655
I like to think of the right answer as being the one "closest" to being right, which was the right answer which I chose despite knowing that the output did not look exactly correct but could not possibly be the other choices in any order.

Another good exercise for the kiddies in class! Keep those QOTD's coming!

Peter Trast
Microsoft Certified ...(insert many literal strings here)
Microsoft Design Architect with Alexander Open Systems
Paul White
Paul White
SSC Guru
SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)SSC Guru (79K reputation)

Group: General Forum Members
Points: 79294 Visits: 11400
Liked the use of TRY...CATCH (though checking XACT_STATE would be cool).
Disliked the loop.
On balance: not bad.



Paul White
SQLPerformance.com
SQLblog.com
@SQL_Kiwi
Welsh Corgi
Welsh Corgi
SSC Guru
SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)SSC Guru (68K reputation)

Group: General Forum Members
Points: 68304 Visits: 4895
A poorly worded trick question.

For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/

For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search