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)
 Fetching records alternately

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-21 : 10:26:02
Zaldy writes "Hi, I would like to know if you have a solution regarding fetching records alternately. For example, I want to have records from a table which is 10 records far from the current record until it is EOF. If i have a hundred records in the table, it must return 10 records, which was chosen 10 records apart. It is useful when you want to paginate records alphabetically like in an encyclopedia...such as aadvark-diamond, diamond-elephant etc...

Thank you."

nr
SQLTeam MVY

12543 Posts

Posted - 2002-08-21 : 12:02:57
First of all you have to order the records.
Easiest way of doing this is probably to insert into a temp table with an identity then use a modulous on it.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -