Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
Article Discussions
»
Article Discussions by Author
»
Discuss content posted by Sudhir Chawla
»
Dynamic SQL
33 posts, Page 3 of 4
««
«
1
2
3
4
»»
Dynamic SQL
Rate Topic
Display Mode
Topic Options
Author
Message
john.curran.z3g
john.curran.z3g
Posted Wednesday, January 06, 2010 6:00 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, February 18, 2013 7:25 AM
Points: 236,
Visits: 53
I chose C because there wasn't a 'D - None of the above'.
My instance of SQL 2005 coughs with the error:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.Employees'.
and returns NULL as a result.
Post #842708
Lynn Pettis
Lynn Pettis
Posted Wednesday, January 06, 2010 6:32 AM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 8:06 AM
Points: 21,596,
Visits: 27,416
john.curran.z3g (1/6/2010)
I chose C because there wasn't a 'D - None of the above'.
My instance of SQL 2005 coughs with the error:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.Employees'.
and returns NULL as a result.
Try it after you change the table name in the variable to a table that exists in the database you are running the code.
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 #842729
Dan Guzman - Not the MVP
Dan Guzman - Not the MVP
Posted Wednesday, January 06, 2010 9:51 AM
Say Hey Kid
Group: General Forum Members
Last Login: Friday, April 26, 2013 11:57 AM
Points: 708,
Visits: 660
I have to laugh,
After seeing all these comments about what should have been implied and what was inferred, I can't tell you the number of times these QotD have been trick questions, trying to 'get you' with slight and small syntax errors or db assumptions, intentionally generating an error message.
Just because someone ran the code and got an error message does not mean the error message was not the correct answer.
In this case, an error message was not option 'D', so I proceeded with the assumption that at least one of the three generated correct results.
Thanks for the question Sudhir. I enjoyed this one.
Post #842970
JF1081
JF1081
Posted Thursday, January 14, 2010 8:01 AM
SSC-Addicted
Group: General Forum Members
Last Login: Tuesday, December 07, 2010 8:13 AM
Points: 436,
Visits: 322
Steve Eckhart (1/5/2010)
Like others, I answered A because it returned "the expected output": NULL. Option C returns an error:
I am guilty of copying and pasting when I do not know an answer, but I don't get mad if I don't get my points becasue I obviously didn't know the answer anyway.
Post #847563
L' Eomot Inversé
L' Eomot Inversé
Posted Tuesday, February 09, 2010 7:18 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:54 AM
Points: 7,086,
Visits: 7,138
OK, I answered C because A and B are so completely wrong that C is the only option where we can reasonably guess that the setter of the question got it wrong enough to think C would work. So I got my point - for understanding the sort of stupid error that the question setter would make, not for producing a correct answer (because "(D) none o the above" is the correct answer, but not available). This is a really bloody awful question and answer.
I'm seeing far too much of thios sort or thing in QOD. Presumably it's completely unmoderated?
Tom
Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
Post #862885
L' Eomot Inversé
L' Eomot Inversé
Posted Tuesday, February 09, 2010 7:30 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:54 AM
Points: 7,086,
Visits: 7,138
Rupal Raval (1/5/2010)
what error does it throw?
have you written
'declare @tablevariable varchar(100)
set @tablevariable = 'any valid table name'
Before code C?
map @tablevariable to one of your database table, select that database as current database and then execute the code
No, and it wouldn't help if I did. I don't have a table called 'any valid table name' in any database on my server. (I know that sounds nasty - but the provocation was extreme!)
Claiming that this is a sensible question with a sensible answer because it's obvious that unless you change the question all the answers are wrong is just nonsense. Yes, there are real life situations like that (the requirement as provided is nonsense), but in those situations you should not guess what part of the question (requirement) you have to change, you should throw the thing back at whoever provided the question and point out that it's nonsense. Otherwise you risk finding yourself spending a lot of effort on doing something completely useless, because you guessed wrong. And in practise, no matter how obvious it looks to you what the required modification is, you are NOT the person who understands the business inside out and specifies the requirement, so your guess will often be wrong. (If you were the person with that knowledge and understanding, you would be writing the requirement, and would not make silly errors like that - I hope.)
Tom
Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
Post #862891
Lynn Pettis
Lynn Pettis
Posted Tuesday, February 09, 2010 7:40 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 8:06 AM
Points: 21,596,
Visits: 27,416
Tom.Thomson (2/9/2010)
OK, I answered C because A and B are so completely wrong that C is the only option where we can reasonably guess that the setter of the question got it wrong enough to think C would work. So I got my point - for understanding the sort of stupid error that the question setter would make, not for producing a correct answer (because "(D) none o the above" is the correct answer, but not available). This is a really bloody awful question and answer.
I'm seeing far too much of thios sort or thing in QOD. Presumably it's completely unmoderated?
Okay, explain to me why C, although the correct answer, is wrong.
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 #862894
Lynn Pettis
Lynn Pettis
Posted Tuesday, February 09, 2010 7:41 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 8:06 AM
Points: 21,596,
Visits: 27,416
Tom.Thomson (2/9/2010)
Rupal Raval (1/5/2010)
what error does it throw?
have you written
'declare @tablevariable varchar(100)
set @tablevariable = 'any valid table name'
Before code C?
map @tablevariable to one of your database table, select that database as current database and then execute the code
No, and it wouldn't help if I did. I don't have a table called 'any valid table name' in any database on my server. (I know that sounds nasty - but the provocation was extreme!)
Claiming that this is a sensible question with a sensible answer because it's obvious that unless you change the question all the answers are wrong is just nonsense. Yes, there are real life situations like that (the requirement as provided is nonsense), but in those situations you should not guess what part of the question (requirement) you have to change, you should throw the thing back at whoever provided the question and point out that it's nonsense. Otherwise you risk finding yourself spending a lot of effort on doing something completely useless, because you guessed wrong. And in practise, no matter how obvious it looks to you what the required modification is, you are NOT the person who understands the business inside out and specifies the requirement, so your guess will often be wrong. (If you were the person with that knowledge and understanding, you would be writing the requirement, and would not make silly errors like that - I hope.)
Explain to me why you think each of the answers is wrong.
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 #862896
L' Eomot Inversé
L' Eomot Inversé
Posted Tuesday, February 09, 2010 8:06 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:54 AM
Points: 7,086,
Visits: 7,138
Lynn Pettis (2/9/2010)
Okay, explain to me why C, although the correct answer, is wrong.
Becasue all the code options povide produce an error or NULL. Now if you think that an error or NULL is the expected result, then one of them may be right and it might be C. I thought that the expected result was some useful data, not an error message or NULL, so that none of the suggested answers produced the expected result. I may have been wrong - maybe case C produced the expected error message, in which case I have to ask why that error message rather than the result of A or B is the expected result. Do you have an answer for that? Or are you taking the rather arrogant view that because you don't like the question you will reformulate it to mean something different (perhaps something more fully specified) rather than refer it back to the poser?
Tom
Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
Post #862904
L' Eomot Inversé
L' Eomot Inversé
Posted Tuesday, February 09, 2010 8:40 PM
SSCertifiable
Group: General Forum Members
Last Login: Today @ 1:54 AM
Points: 7,086,
Visits: 7,138
Lynn Pettis (2/9/2010)
Explain to me why you think each of the answers is wrong.
Because each answer tries to select from a table with a particular name in an completely unspecified database. That table probably doesn't exist in most databases (it doesn't exist in any DB on any server I ever controlled - and I'll leave you to guess whether that means that I never controlled an HR or Payroll DB or that the table just happened to be named "seirbhiseach" or "Angestellte" instead of "employee".
In the real world it's no good doing what the commenter to whom I was replying suggested - just pick any database you have and then pick any table you have in that DB and then make the query refer to that table - whoever produced the requirement had something in mind, and surely it wasn't to let the developer pick the database and table at random. OK, so here we are talking about QOD instead of about real requirements, and the standard of questions is sometimes pretty low so adjusting the question might often make sense - but as a general rule I think we should try to treat the questions as if they are hard and fast, not subject to adjustment without obtaining agreement from the poser, because in the real world all the badly formulated (and often completely wrong-headed) requirements we see have to go through that negotiate with the poser process.
Tom
Que conclure à la fin de tous mes longs propos? C'est que les préjugés sont la raison des sots. (Voltaire, 1756)
Post #862909
« Prev Topic
|
Next Topic »
33 posts, Page 3 of 4
««
«
1
2
3
4
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.