Chaitanya 2012-02-28 08:10:32
I have a database consisting of more than 2000 records. I
need only a certain number of records be displayed on the
page at a time. When I click ‘next’ Another set of same
number of records need to be displayed. I know ‘top’ and
‘rowcount’. But how can I select a range of records, say
from 1-10 and then 11-20 so on, using sql query?
William ryan 2012-02-28 08:10:34
What are you doing this in ASP.NET? You can set the paging to 10 and then
iterate through it.
Vishal parkar 2012-02-28 08:10:36
This may help you to some level.
Chaitanya vakk 2012-02-28 08:10:38
Thanks for your reply.
I’m using ASP. Not .NET.
*** Sent via Developersdex http://www.developersdex.com ***
Don’t just participate in USENET…get rewarded for it!
Yigong 2012-02-28 08:10:48
MSSQL server seems no way to get the current sequence
value on a query result. However, you may use the temp
table to do this. Here is very simple example of a stored
procedure that should do what you need to do.
CREATE PROCEDURE dbo.Subset
SELECT IDENTITY(INT, 1, 1) AS ident, * INTO #T1 from
select * from #T1 where ident >= @startpoint and ident <= @startpoint+@range-1 GO ---------------------