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 12345»»»

How many rows are returned from the query below? Expand / Collapse
Author
Message
Posted Tuesday, March 2, 2010 8:54 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Monday, October 22, 2012 7:08 AM
Points: 233, Visits: 112
Comments posted to this topic are about the item How many rows are returned from the query below?

Thanks,

Ashka Modi
Software Engineer || credEcard Technologies (india) Pvt. Ltd.
Post #875659
Posted Tuesday, March 2, 2010 10:03 PM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Yesterday @ 10:34 PM
Points: 1,504, Visits: 2,528
I got an error when I tried in SQL Server 2005...!!!
Post #875667
Posted Tuesday, March 2, 2010 10:48 PM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Thursday, May 2, 2013 1:50 AM
Points: 167, Visits: 37
That query gives perfect result.


Thanks.
Mandar Kavishwar.
EC Infosolution
Post #875682
Posted Wednesday, March 3, 2010 12:07 AM
Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Saturday, April 16, 2011 10:29 AM
Points: 502, Visits: 399
Seems to be a lot missing assumptions. Each given answer can be correct given different starting conditions.

Running the code as-is got me an error first (tblUsers does not exist. doh!).

I then created the table and got 0 rows as the result.

I added 1 row and got 1 row as the result.

Added another row and got 2 rows as the result.

Adding more rows kept the result at 2 rows.

Post #875707
Posted Wednesday, March 3, 2010 1:02 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, July 1, 2014 6:20 AM
Points: 1,339, Visits: 1,312
WTF is tblUsers?
It can be a table or a view or nothing.

If it is anything defined (table or view) it can be empty (0 rows returned), it can contain just 1 row (1 row returned) or it can contain more rows (2 rows returned).
With these assumptions - three answers possible - tblUsers is undefined and the script returns an error message. QED




See, understand, learn, try, use efficient
© Dr.Plch
Post #875728
Posted Wednesday, March 3, 2010 1:29 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, June 30, 2014 2:51 AM
Points: 1,972, Visits: 369
i fail to understand what is the learning in this question. anybody plz. suggest...
Post #875739
Posted Wednesday, March 3, 2010 1:32 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Monday, June 30, 2014 2:51 AM
Points: 1,972, Visits: 369
if the query contains a top 3

SELECT top 3 c.*, Users.* FROM reptec_changedim c, Users

then this will return 3 records...
Post #875740
Posted Wednesday, March 3, 2010 2:21 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Today @ 4:34 AM
Points: 854, Visits: 171
I get an error saying tblUsers doesn't exist.. Is this a Version issue or missing information? im on SQL 2005
Post #875757
Posted Wednesday, March 3, 2010 2:26 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:44 AM
Points: 1,178, Visits: 2,645
Aam-624390 (3/3/2010)
Seems to be a lot missing assumptions. Each given answer can be correct given different starting conditions.


Agreed, question is incomplete and I fail to see the point of it.


--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #875759
Posted Wednesday, March 3, 2010 2:27 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 7:44 AM
Points: 1,178, Visits: 2,645
ziangij (3/3/2010)
i fail to understand what is the learning in this question. anybody plz. suggest...


No idea!!!!


--
Nigel
Useful Links:
How to post data/code on a forum to get the best help
The "Numbers" or "Tally" Table - Jeff Moden

Post #875760
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse