DECLARE @first_id int
SET ROWCOUNT @startRowIndex
SELECT @first_id = ID_Field FROM Table
Such a query assigns the last value of ID_Field in the result set to @first_id. Since the SET ROWCOUNT limits the result set size to the starting row index, the last record returned in the first record of the page to retrieve. Once this value has been obtained, the following query returns the appropriate page of data:
SET ROWCOUNT @recordsPerPage
SELECT ... FROM Table
WHERE ID_Field >= @first_id