I was wondering if you could do something like this is Microsoft SQL Server 2k8 R2
Say I have a query which returns 100 rows of data.
Is their a way I can pass in some variables for example @lower_limit and @upper_limit.
Then I want the query to record the rows between the lower and upper limit
For example:
@lower_limit = 5
@upper_limt 10
Would return me rows 5 – 10 from the 100 records.
You can assign a ROW_NUMBER() over your result set and then use the
BETWEENstatement to limit the rows.A contrived example:
EDIT: For standard paging, here’s exactly the technique I use in all the applications I develop: