Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Selective Rows Returned From Select

Author  Topic 

TeenageKicks
Starting Member

9 Posts

Posted - 2006-01-25 : 09:45:41
Hi,

I have a problem that I would like help with.

I have to write an SQL Server 2000 stored procedure that returns rows from a table (a SELECT with an ORDER BY). A front end system calls the stored procedure and displays the returned rows. If there is more than one screen's worth of data (ie more than 20 rows returned from the table) then there is a requirement that the stored procedure only returns the rows for the screen ie, for screen 1 I need to return rows 1-20, for screen2 I need to return rows 21-40, screen 3 = rows 41-60.

The screen number will be passed into the stored procedure so I can work out what rows to return, the only problem is how can I tell SQL Server to only select the required rows (ie, say rows 21 to 40 from the returned rows). I can't see any arguments that allow selective rows to be returned (apart from TOP).

Any ideas??

Regards,

Chris

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-01-25 : 09:56:21
http://weblogs.sqlteam.com/jeffs/archive/2004/03/22/1085.aspx

Go with the flow & have fun! Else fight the flow
Go to Top of Page

TeenageKicks
Starting Member

9 Posts

Posted - 2006-01-25 : 10:47:41
Thanks for the help spirit1 - that looks like the solution to my problem!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-27 : 01:06:38
Also refer
http://www.aspfaq.com/show.asp?id=2120

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -