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 «««1718192021»»

That case filter Expand / Collapse
Author
Message
Posted Wednesday, July 27, 2011 4:46 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Thursday, July 10, 2014 1:48 AM
Points: 2,359, Visits: 730
This is just a fowl joke

How many rows are returned

None as there is no Select as the code is given. There is no correct answer (0 is not an option)

by executing all of the following in one batch

Table is in variable. How can be insert executed without declare

case filter

Case is not considered because the table is still empty at the time of execution.

(copy / paste error)

How the hell could anyone see this coming

It seems the answer depends on what was someone thinking on how to play a prank on QOTD community

Post #1148960
Posted Wednesday, July 27, 2011 4:51 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, January 24, 2013 9:59 PM
Points: 1,354, Visits: 1,299
dawryn (7/27/2011)

by executing all of the following in one batch

Table is in variable. How can be insert executed without declare

There was a declare. It was at the top of the query:
DECLARE @openorder INT
SET @openorder = 2
DECLARE @tbl TABLE (openorder INT)

Post #1148965
Posted Wednesday, July 27, 2011 5:16 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 12:52 AM
Points: 21,385, Visits: 9,601
dawryn (7/27/2011)
This is just a fowl joke

How many rows are returned

None as there is no Select as the code is given. There is no correct answer (0 is not an option)

by executing all of the following in one batch

Table is in variable. How can be insert executed without declare

case filter

Case is not considered because the table is still empty at the time of execution.

(copy / paste error)

How the hell could anyone see this coming

It seems the answer depends on what was someone thinking on how to play a prank on QOTD community




Thank you for reading my full explaination (my first post) and then the subsequent 150+ answers. All your questions have been adressed already.
Post #1148980
Posted Wednesday, July 27, 2011 8:19 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: Yesterday @ 5:53 PM
Points: 8,543, Visits: 9,030
BenWard (7/27/2011)
I know rowcount would have returned 5, my point was that Microsoft's developers themselves consider no results grid to equal 0 rows not null rows.

I'm glad the MS developers got it right. Of course I agree with them and with you. And of course with Ninja's_RGR'us.

In the UK it's taught to 5 and 6 year old children in infant school (I guess that's what USA calls grade 1 and grade 2 ?). They learn that an empty bag of beans contains 0 beans.

So when they grow up and become DBAs, the really should realise that if a statement doesn't return any rows, it returns 0 rows.

It's a pity some of the commenters on this topic apparently missed those early lessons on numbers and arithmetic.


Tom
Post #1149230
Posted Wednesday, July 27, 2011 8:43 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 12:52 AM
Points: 21,385, Visits: 9,601
Tom.Thomson (7/27/2011)
BenWard (7/27/2011)
I know rowcount would have returned 5, my point was that Microsoft's developers themselves consider no results grid to equal 0 rows not null rows.

I'm glad the MS developers got it right. Of course I agree with them and with you. And of course with Ninja's_RGR'us.

In the UK it's taught to 5 and 6 year old children in infant school (I guess that's what USA calls grade 1 and grade 2 ?). They learn that an empty bag of beans contains 0 beans.

So when they grow up and become DBAs, the really should realise that if a statement doesn't return any rows, it returns 0 rows.

It's a pity some of the commenters on this topic apparently missed those early lessons on numbers and arithmetic.



I can't believe this is actually still being debated by the same people as last week (new people I'd understand... but still).

Did I inadvertently start a new "are the questions getting worse" thread?!?!?!
Post #1149254
Posted Wednesday, July 27, 2011 8:43 AM


Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, June 13, 2014 7:51 AM
Points: 367, Visits: 634
Tom.Thomson (7/27/2011)
BenWard (7/27/2011)
I know rowcount would have returned 5, my point was that Microsoft's developers themselves consider no results grid to equal 0 rows not null rows.

I'm glad the MS developers got it right. Of course I agree with them and with you. And of course with Ninja's_RGR'us.

In the UK it's taught to 5 and 6 year old children in infant school (I guess that's what USA calls grade 1 and grade 2 ?). They learn that an empty bag of beans contains 0 beans.

So when they grow up and become DBAs, the really should realise that if a statement doesn't return any rows, it returns 0 rows.

It's a pity some of the commenters on this topic apparently missed those early lessons on numbers and arithmetic.


lol nicely put

I think it's a case of how you view things. Personally, I see things in real life/english first and technical stuff second. The question was written in English, with some real life wording which prompted me to answer in real life/english.

If you approach QotD seeing things in technical language first and real-life english second I can understand why you'd get stuck on semantics.

The argument is, I suppose, that being given an empty bean bag is semantically different from not even having been given a bag at all. the result is the same either way, you have no beans.

if you have no bean bag, and you are asked how many beans you have, the answer would be zero. if asked what was in your bean bag, the answer would be 'Error on line 1: variable $myBag has not been set'

The question was however worded in the way of 'how many beans do you have' and not 'what is in your bean bag'. Therefore the answer WAS logically zero and not null or error anything else.


Ben

^ Thats me!


----------------------------------------
01010111011010000110000101110100 01100001 0110001101101111011011010111000001101100011001010111010001100101 01110100011010010110110101100101 011101110110000101110011011101000110010101110010
----------------------------------------
Post #1149256
Posted Wednesday, July 27, 2011 5:31 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 31, 2013 9:20 PM
Points: 18, Visits: 98
They learn that an empty bag of beans contains 0 beans.

And kids in Australia learn pretty young the futility of trying to count the number of beans in a non-existent bag.

If I hand you a box and ask "How many beans in this bag?", which answer is more correct: "There are no beans in that bag", "There are no beans in that box", or "That is a box, not a bag"?

ROSCO
Post #1149745
Posted Wednesday, July 27, 2011 5:35 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, October 31, 2013 9:20 PM
Points: 18, Visits: 98
BenWard (7/27/2011)
I know rowcount would have returned 5, my point was that Microsoft's developers themselves consider no results grid to equal 0 rows not null rows.

And my point was that if the question had been "What do Microsoft's developers consider to be the number of rows returned by this query?" the answer 0 may have been more correct. But that was not the question.

ROSCO
Post #1149746
Posted Wednesday, August 3, 2011 4:47 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, February 6, 2014 4:15 AM
Points: 1,242, Visits: 1,546
good one. but confusing



Thanks
Vinay Kumar
-----------------------------------------------------------------
Keep Learning - Keep Growing !!!
www.GrowWithSql.com

Post #1153385
Posted Wednesday, August 3, 2011 5:41 AM


SSC-Insane

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

Group: General Forum Members
Last Login: Wednesday, July 16, 2014 12:52 AM
Points: 21,385, Visits: 9,601
Danny Ocean (8/3/2011)
good one. but confusing


Glad it made you think... enjoyed the brain work out?

Post #1153413
« Prev Topic | Next Topic »

Add to briefcase «««1718192021»»

Permissions Expand / Collapse