Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > selecting a range of records from the database
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 28th February 10:10
chaitanya
External User
 
Posts: 1
Default selecting a range of records from the database


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.
  Reply With Quote


  sponsored links


2 28th February 10:10
william ryan
External User
 
Posts: 1
Default selecting a range of records from the database


What are you doing this in ASP.NET? You can set the paging to 10 and then
iterate through it.
  Reply With Quote
3 28th February 10:10
vishal parkar
External User
 
Posts: 1
Default selecting a range of records from the database


This may help you to some level.

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

--
- Vishal
  Reply With Quote
4 28th February 10:10
chaitanya vakkalanka
External User
 
Posts: 1
Default selecting a range of records from the database


Thanks for your reply.
I'm using ASP. Not .NET.
Chaitanya.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  Reply With Quote
5 28th February 10:10
yigong
External User
 
Posts: 1
Default selecting a range of records from the database


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
---------------------
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666