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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Fetch n number of records from index position m.

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-03-02 : 07:52:58
Gops writes "1.How can i fetch records from 100000 to 100025 using a query or ADO. i dont have a primary key for my log table which contains 5 lakh records. I was using ADO recordset's Move method to reach the index and then fetching only required number of records. But for moving to 100000th position takes too much time. Even the query takes too much time. Is there any other way to specify the start index. The sorting will take too much time.

Select Top 25 from MyLog order by EntryTime. But i want records starting at 100000th position."

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2005-03-02 : 08:58:17
You need a primary key do be able to do anything useful with your table using SQL.

Good luck!

- Jeff
Go to Top of Page

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2005-03-02 : 13:06:57
I think You are going about it the wrong way.
Why fixing the nTh record, surely that is not the interesting part.
Why not fix the EntryTime ? (which btw is probably a good column to have in a clusterd index anyway, since it is a logtable)

The queries would then be restricted by EntryTime, which would be quick.
select top 25 ... from tbllog where EntryTime between ... and ... order by EntryTime [,otherkeycols]

Make EntryTime part of a clustered PK/UNIQUE INDEX.


rockmoose
Go to Top of Page
   

- Advertisement -