all groups > sql server mseq > september 2003 >
You're in the

sql server mseq

group:

selecting a range of records from the database


selecting a range of records from the database Chaitanya
9/17/2003 12:30:20 PM
sql server mseq:
Hi all,
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?
Please help.
Chaitanya.
Re: selecting a range of records from the database Chaitanya Vakkalanka
9/17/2003 2:54:26 PM
Thanks for your reply.
I'm using ASP. Not .NET.
Chaitanya.

*** Sent via Developersdex http://www.developersdex.com ***
Re: selecting a range of records from the database William Ryan
9/17/2003 3:53:59 PM
What are you doing this in ASP.NET? You can set the paging to 10 and then
iterate through it.
[quoted text, click to view]

Re: selecting a range of records from the database Vishal Parkar
9/18/2003 1:32:09 AM
This may help you to some level.

http://www.aspfaq.com/show.asp?id=2120

--
- Vishal
[quoted text, click to view]

selecting a range of records from the database Yigong
9/19/2003 10:12:06 AM
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

@startpoint int,
@range int

AS

SELECT IDENTITY(INT, 1, 1) AS ident, * INTO #T1 from
mytable

select * from #T1 where ident >= @startpoint and ident <=
@startpoint+@range-1
GO
---------------------

[quoted text, click to view]
AddThis Social Bookmark Button