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

More on Returning a Subset of a Recordset Expand / Collapse
Author
Message
Posted Wednesday, September 26, 2001 12:00 AM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Tuesday, December 7, 2010 6:58 AM
Points: 115, Visits: 17
Comments posted to this topic are about the content posted at http://www.sqlservercentral.com/columnists/jwiner/moreonreturningasubsetofarecordset.asp


Post #1139
Posted Wednesday, December 19, 2001 5:16 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, December 19, 2001 12:00 AM
Points: 1, Visits: 1
lol - ok, nicely done. Somewhat more efficient than cursors :)
Why don't you just build a table and then use a between? The following example is in T-SQL as it allows the handy table var (automatically cleared after sp exec)

CREATE PROCEDURE getSubset (@start int, @end int) AS

DECLARE @tblTemp TABLE (pID int,
intData int,
strData nvarchar(50))

INSERT INTO @tblTemp
SELECT /*insert main functionality of sp here*/

SELECT *
FROM @tblTemp
WHERE pID between
@start and
@end
ORDER BY intData

Life's not difficult...enjoy it.
Nood!e



Post #21925
Posted Wednesday, December 19, 2001 5:36 PM
SSC-Enthusiastic

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

Group: General Forum Members
Last Login: Tuesday, December 7, 2010 6:58 AM
Points: 115, Visits: 17
Thanks for your feedback. Your approach is definitely a solid option. Many ways to skin a cat.




Post #21926
Posted Tuesday, July 19, 2005 8:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, August 24, 2010 7:37 AM
Points: 1, Visits: 2

what happens when the field you order by on

is null

for many records

for example :

select top 10 custnum,custname from customers where custname >

(select max(custname)  from customers ) A order by custname

 

when you got many records where custname = null

then the result is null

resolve that please

 

Post #202373
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse