November 19, 2011 at 12:19 pm
Comments posted to this topic are about the item Output Parameter
November 20, 2011 at 9:13 pm
November 20, 2011 at 10:08 pm
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).
November 20, 2011 at 11:43 pm
I like the idea of the question, but it could have been worked out better, as vk-kirov mentioned.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 21, 2011 at 2:03 am
+1 on the order by and 2 points on this one seemed like a little much ;-).
November 21, 2011 at 2:33 am
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 π
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 21, 2011 at 4:15 am
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
November 21, 2011 at 4:31 am
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! π
November 21, 2011 at 4:33 am
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. π
(it happens to me on a weekly basis)
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
November 21, 2011 at 6:30 am
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
November 21, 2011 at 7:05 am
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! π
IT DEPENDS!
There I did it for you π
since it didn't have an IT DEPENDS answer, I went with one of the likely assumption ones and got it right.
November 21, 2011 at 7:07 am
mtassin (11/21/2011)
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! π
IT DEPENDS!
There I did it for you π
Those letters have been worn out of the keyboard I use, I need to use ctrl-numpad to type in those letters. Too much trouble :-D.
November 21, 2011 at 7:40 am
Ninja's_RGR'us (11/21/2011)
mtassin (11/21/2011)
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! π
IT DEPENDS!
There I did it for you π
Those letters have been worn out of the keyboard I use, I need to use ctrl-numpad to type in those letters. Too much trouble :-D.
I had the same problem. I got lucky and purchasing bought me a new $15 PS2 keyboard. I can type IT DEPENDS for a few more months again.
November 21, 2011 at 7:44 am
mtassin (11/21/2011)
Ninja's_RGR'us (11/21/2011)
mtassin (11/21/2011)
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! π
IT DEPENDS!
There I did it for you π
Those letters have been worn out of the keyboard I use, I need to use ctrl-numpad to type in those letters. Too much trouble :-D.
I had the same problem. I got lucky and purchasing bought me a new $15 PS2 keyboard. I can type IT DEPENDS for a few more months again.
I should get a macro program to be able to just hit something like ctrl-alt-shit-i :-D.
And with shipping + install it's like 200$. A new computer might almost be cheaper at that point! Unless I buy what I really want! :hehe:
November 21, 2011 at 9:14 am
L' Eomot InversΓ© (11/21/2011)
Nice avatar
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 15 posts - 1 through 15 (of 30 total)
You must be logged in to reply to this topic. Login to reply