With the new row_number() feature of the MS SQL Server 2005, now it’s very easy to implement pagination: get data rows page by page to avoid the retrieve too much data at same time. The new feature it’s very similar to the Oracle ROWUM.
The prepare statement could be like the follow:
SELECT * FROM ( SELECT row_number() OVER (ORDER BY id) as resultNum, id FROM table_name) as numberResultsWHERE resultNum BETWEEN ? AND ?
More information here.
Technorati Tags: SQL Server, row_number