Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««23456»»»

Predict output Expand / Collapse
Author
Message
Posted Wednesday, January 20, 2010 9:05 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, September 9, 2013 6:24 AM
Points: 118, Visits: 37
I agree with the others here. The proffered answers were not adequate because there was too much ambiguity on what should be considered "output". If you are expecting that "output" is the result of the SELECT, then there was no correct answer. If you expected "output" to mean both messages and results, then the supposed correct answer is also not accurate.

This question was just poorly worded. Try... Catch is a concept that is very important to understand though, so I appreciate the intent.



Kindest Regards,

Rick Farris
nimbussoftware.com
Post #850571
Posted Wednesday, January 20, 2010 10:32 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, June 3, 2014 7:31 AM
Points: 155, Visits: 386
Lynn Pettis (1/20/2010)

It isn't just the QotD that you can learn from, but also the discussion that may follow (as long as you ignore the complaints).

Does SSC vet the questions, to a point, but not nearly as well as some people would like to see. Of all the questions I have answered, I think I only really had a serious complaint about one or two. Yes, there are issues with some of the questions, but if you look closer at the concept that the question is trying to address, and less on the question and answers themself, I think you will learn something.

Take today's question. Based on the answers, you'd have expected there to be PRINT statements in the question but there wasn't. If you understand the concept of the TRY/CATCH, and that the divide by zero would be caught and handled in the CATCH part of the code, there really was only one answer that made sense, and it happened to be the only one with the message from the PRING statment in the CATCH block.


I strongly disagree. I am not trying to be a jerk but this is not the first time people have complained about ambiguous answers from arup.

What concept do new people get from incorrect answers as options? None of the answers fit at all. The fact that you assumed you knew what the author meant and selected your answer based on an assumption and not knowing proves this. What if I assumed the author missed a PRINT @i.

I learned nothing from this except:
-there can be mingling between result set and messages in the answer for a QoTD.
-It is now possible for an integer field to display a string in the answer for the QoTD.
-Ambiguity is now acceptable for listed answers to the QoTD just like irregardless is now accepted as a word by dictionaries.

Post #850662
Posted Wednesday, January 20, 2010 10:47 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 7:45 PM
Points: 23,081, Visits: 31,620
Fatal Exception Error (1/20/2010)
Lynn Pettis (1/20/2010)

It isn't just the QotD that you can learn from, but also the discussion that may follow (as long as you ignore the complaints).

Does SSC vet the questions, to a point, but not nearly as well as some people would like to see. Of all the questions I have answered, I think I only really had a serious complaint about one or two. Yes, there are issues with some of the questions, but if you look closer at the concept that the question is trying to address, and less on the question and answers themself, I think you will learn something.

Take today's question. Based on the answers, you'd have expected there to be PRINT statements in the question but there wasn't. If you understand the concept of the TRY/CATCH, and that the divide by zero would be caught and handled in the CATCH part of the code, there really was only one answer that made sense, and it happened to be the only one with the message from the PRING statment in the CATCH block.


I strongly disagree. I am not trying to be a jerk but this is not the first time people have complained about ambiguous answers from arup.

What concept do new people get from incorrect answers as options? None of the answers fit at all. The fact that you assumed you knew what the author meant and selected your answer based on an assumption and not knowing proves this. What if I assumed the author missed a PRINT @i.

I learned nothing from this except:
-there can be mingling between result set and messages in the answer for a QoTD.
-It is now possible for an integer field to display a string in the answer for the QoTD.
-Ambiguity is now acceptable for listed answers to the QoTD just like irregardless is now accepted as a word by dictionaries.



Okay. I'll shut up now.



Lynn Pettis

For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here or when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here and here
Managing Transaction Logs

SQL Musings from the Desert Fountain Valley SQL (My Mirror Blog)
Post #850685
Posted Wednesday, January 20, 2010 11:14 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Tuesday, December 7, 2010 12:55 AM
Points: 771, Visits: 504
Just so you know, Lynn, I appreciate your insights, especially on items such as the QotD.

I did find the answers a little ambiguous, but I learned a bit more about analysis.

Thanks.

Kevin C.
Post #850704
Posted Wednesday, January 20, 2010 3:32 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Yesterday @ 10:02 PM
Points: 21,342, Visits: 15,017
Lynn Pettis (1/20/2010)
mzz3lh (1/20/2010)
I have to agree here. None of the answers match what I would expect, which would be 'This is an exception' in the message pane, followed by the contents of the temp table: 1, 2, 4, 5.

However, when I ran this to try it out, I got an error:
(1 row(s) affected)

(1 row(s) affected)
this is an exception
Msg 208, Level 16, State 0, Line 10
Invalid object name '#temp'.


Which indicates that despite the try-catch block, the error caused the temp table to be dropped mid-execution.


Or that something was wrong with the code you ran. It ran fine for me, and it appears from a few other posts that it ran fine for others.


I agree, the answers may not have been displayed as many of us have seen it when we ran the code. The question is, were you able to correctly predict the output? In this case, as mentioned in another post, there really was only one option that could be correct. It may have been more difficult had there been one or two more possible answers with the exception message included.



Agreed here, there is only one answer that supplies both pieces of the answer. All other answers were invalid.

Settings in your SSMS would cause slightly different output. One scenario includes set nocount, and whether or not it is on or off.

set nocount on gives me the following in the message pane:
this is an exception

set nocount off gives the following
(1 row(s) affected)

(1 row(s) affected)
this is an exception

(1 row(s) affected)

(1 row(s) affected)

(4 row(s) affected)

I think being overly picky about the presentation of the available answer in this scenario is going beyond what the question was trying to derive.

We have been shown that both parts of the correct answer are only available in one of the answers.




Jason AKA CirqueDeSQLeil
I have given a name to my pain...
MCM SQL Server


SQL RNNR

Posting Performance Based Questions - Gail Shaw
Posting Data Etiquette - Jeff Moden
Hidden RBAR - Jeff Moden
VLFs and the Tran Log - Kimberly Tripp
Post #850899
Posted Wednesday, January 20, 2010 3:47 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Monday, September 9, 2013 6:24 AM
Points: 118, Visits: 37
Agreed, Jason. The intent of the question was good and purposeful, no doubt.

Funny that most of us, as technologists, are so insistent on a perfectly valid scenario. :) The point wasn't lost on me, but I am adamant about well thought-out surveys. I remain left to wonder, for example, how much thought went into this question and for what reasons. This is and will be my main reason for engaging in this discussion, as has been my practice in prior discussions.



Kindest Regards,

Rick Farris
nimbussoftware.com
Post #850909
Posted Wednesday, January 20, 2010 10:44 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Sunday, July 18, 2010 7:16 AM
Points: 4, Visits: 4
Nice QoTD .

An important point to remember is that a TRY..CATCH can be used to catch all database errors having the error number >10 that do not terminate a database connection.

MSDN has more information on this.

http://msdn.microsoft.com/en-us/library/ms175976.aspx

Post #851014
Posted Thursday, January 21, 2010 4:13 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Friday, July 11, 2014 4:33 AM
Points: 71, Visits: 250
Apart from that, what's going on with the transaction? Nobody's mentioned that, but isn't that kind of weird? (Don't shoot me if it's obvious, I'm primarily a .Net guy rather than a DBA, so Try . . .Catch was familiar ground; but that rollback in the middle - can you do that?)
Post #851131
Posted Thursday, January 21, 2010 7:14 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 24, 2014 7:11 AM
Points: 2,382, Visits: 177
I am assuming one of the answers has to be correct. It's just that the "correct" answer isn't really in the form that my result window showed. We got the point though.
Post #851238
Posted Thursday, January 21, 2010 7:49 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, March 8, 2013 8:32 AM
Points: 26, Visits: 41
that's because the 'correct' answer wasn't correct.
Post #851264
« Prev Topic | Next Topic »

Add to briefcase «««23456»»»

Permissions Expand / Collapse