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
Tell me in details how to Implement Pagination with code
Thanks for the tip
Hi Aruntyagi……
Please find the code implementaion.
Ramesh.
I think that is not easy, but it’s what we have. Easy it’s the way that MySQL do, like example
SELECT * FROM myTable LIMIT ? OFFSET ?
That is beautiful Query, with a sintax very easy to read. I hope that Microsoft improve this feature in the next versions.