Home > Archive > microsoft.public.cert.mcdba > December 2003 > Retreive 90th -100th rows from a query





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Retreive 90th -100th rows from a query
daniel

2003-12-18, 3:25 pm

If your tables countain a primary key (if not, add them)
from 1 to 2,000,000
your query should be something like this:

Select * from table where id BETWEEN 20 and 30

You can also use some variables and a while to increase
the ranges.

declare @begin int
declare @end int
set @begin=10
set @end=20


While @end <2,000,000 /*You can use the count command to
limit this*/
begin
select * from table where id between @begin and
@end
set @begin=@begin+10
set @end=@end+10
end

>-----Original Message-----
>I have a set of tables with almost 2,00,000 records each.
>I want to search for a particular condition using JOIN

and
>THEN retreive only 20th - 30th record; and not all.
>
>I can use TOP 10 to get 1-10th record; but that doesn't
>solve my purpose as I display the records in a Webpage
>with 10 records each page; and when the user is in the

9th
>page i got to display 90th - 100th record; and so on.
>
>
>DONT want to use cursors.
>Is there any hidden row returned by SQL 2000 which
>contains Serial Number; i.e the record position which
>helps me to achieve it.
>.
>

Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net