Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Output Parameter


Output Parameter

Author
Message
shyam.kishore
shyam.kishore
SSC Veteran
SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)SSC Veteran (235 reputation)

Group: General Forum Members
Points: 235 Visits: 71
Comments posted to this topic are about the item Output Parameter
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)SSCertifiable (6.2K reputation)

Group: General Forum Members
Points: 6151 Visits: 25280
Nice question - a good way to start my week

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

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
vk-kirov
vk-kirov
Hall of Fame
Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)Hall of Fame (3.5K reputation)

Group: General Forum Members
Points: 3532 Visits: 4408
I don't like this question because 1) it has nothing to do with output parameters, 2) a 'SELECT TOP' statement does not guarantee output values without an 'ORDER BY' clause. Strictly speaking, the database engine may return any of the five values from the '@table' table. So both the 1st and the 2nd answers are possible correct answers (and the total number of those answers is 5^3 = 125).
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18581 Visits: 13248
I like the idea of the question, but it could have been worked out better, as vk-kirov mentioned.


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Ninja's_RGR'us
Ninja's_RGR'us
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22179 Visits: 9671
+1 on the order by and 2 points on this one seemed like a little much ;-).
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18581 Visits: 13248
Ninja's_RGR'us (11/21/2011)
+1 on the order by and 2 points on this one seemed like a little much ;-).


The 2 points is just to make your Mondays a bit more bearable :-)


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
TomThomson
TomThomson
SSChampion
SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)SSChampion (11K reputation)

Group: General Forum Members
Points: 11343 Visits: 12086
Koen Verbeeck (11/21/2011)
Ninja's_RGR'us (11/21/2011)
+1 on the order by and 2 points on this one seemed like a little much ;-).


The 2 points is just to make your Mondays a bit more bearable :-)

Fun question, but not to be taken too seriously (as the correct answer, as vvkirov pointed out, is "it depends...") and I agree that 2 points seems a bit much.


edit: I hate sticky shift keys.

Tom

Ninja's_RGR'us
Ninja's_RGR'us
SSC-Insane
SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)SSC-Insane (22K reputation)

Group: General Forum Members
Points: 22179 Visits: 9671
L' Eomot Inversé (11/21/2011)
Koen Verbeeck (11/21/2011)
Ninja's_RGR'us (11/21/2011)
+1 on the order by and 2 points on this one seemed like a little much ;-).


The 2 points is just to make your Mondays a bit more bearable :-)

Fun question, but not to be taken too seriously (as the correct answer, as vvkirov pointed out, is "it depends...") and I agree that 2 points seems a bit much.


edit: I hate sticky shift keys.


I know it depends, but I'm getting sick of making that argument so I was hoping one of you guys would take care ot that! ;-)
Koen Verbeeck
Koen Verbeeck
SSCoach
SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)SSCoach (18K reputation)

Group: General Forum Members
Points: 18581 Visits: 13248
L' Eomot Inversé (11/21/2011)

edit: I hate sticky shift keys.


Then don't waste so much time thinking what you are going to type while holding Shift. :-D
(it happens to me on a weekly basis)


How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?
My blog at SQLKover.

MCSE Business Intelligence - Microsoft Data Platform MVP
Hugo Kornelis
Hugo Kornelis
SSCrazy Eights
SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)SSCrazy Eights (8.8K reputation)

Group: General Forum Members
Points: 8758 Visits: 11718
Ninja's_RGR'us (11/21/2011)
I know it depends, but I'm getting sick of making that argument so I was hoping one of you guys would take care ot that! ;-)

I'll never tire of repeating this, until (hopefully) some day I don't have to do it anymore.
So here goes - without ORDER BY, there is no way to predict which of the five rows will be the TOP 1 row; answer options 1 and 2 are both correct (and there are lots of other correct answer options as well).

The explanation is also partially misleading.
"But if your replace the "SELECT TOP 1 t1 FROM @table" with "SET @ReorderPoint= (SELECT TOP 1 t1 FROM @table)", it give error message like "Error converting data type varchar to int.". "
Well - it may do that. But if the row that happens to be returned by the TOP 1 without ORDER BY is one of the rows with t1 equal to 145.87, 1059.31, or 38.49, it will happily convert taht value from varchar to int (or decimal, or float).

Finally, the "TOP 1" syntax is still supported, but Microsoft recommends against using it. In the officianl syntax, parentheses are required: "TOP (1)".
See http://msdn.microsoft.com/en-us/library/ms189463.aspx


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
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