question

Hamidreza Abbasi avatar image
Hamidreza Abbasi asked

SQL Server Query for pagination

I have SQL Server database and web application. I need pagination to view of records from DB same as Google. My query consists of 1000 records when I need to display page 2 I need records from 11-20. I want to fetch just these 10 records from the DB. I know I can query all 1000 records (this wastes time) and after that I can query the next 10 recordset. I need a better way to query the desired recordset - as an example when the user goes to page 5 (with 10 records per page) I need a query to get record 51-60 (just ten records) an this way is better for response time and network traffic.

best regards Hamidreza Abbasi

paging
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Kristen avatar image
Kristen answered

Do the previous answers on pagination help?

http://ask.sqlteam.com/questions/tagged/paging

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.