With Microsoft SQL Server 2005, paging on the database side is simple. There is a built-in ROW_NUMBER function designed specifically for this task. However, versions of SQL Server prior to 2005 do not have this capability. Below is one way to implement similar functionality in pre-2005 versions.
SELECT
TOP X *
FROM
Records
WHERE
RecordID NOT IN (SELECT TOP Y RecordID FROM Records)
You must replace X and Y with actual integer values, Unfortuantly, due to sql sytanx, you can’t use varaibles. The records returned from the above query will follow
Y + 1 = Beginning record
X + Y + 1 = Ending Record
So 10 and 20 plugged in to X and Y respectively would return records 21 thorugh 31.