In SQL Server 2005, there is a feature called row_number() which makes pagination very simple.
SELECT * FROM table WHERE row_number() between x and y
Is there any SQL server way to do the same thing in SQL Server 2000?
(Note: I don't have access to a unique sequential numbering for the query, i.e. something which would be a synonym for row_number())
Not sure if this is the most elegant solution, but it worked for me when we used SQL 2000...
If you're writing a stored procedure, you can do it with a temporary table.
Create a temporary table which has an automatically incrementing Identity column as well as the same columns as your result set.
Then, select the data from the result set and insert it into this temporary table (in the right order).
Finally, return results from your temporary table where the value of your Identity column acts as your row number.
You can also use cursor for this.
The only problem here is that each row is returned as a separate result set, but it does the job.