What is the best way to paginate results in SQL Server

前端 未结 19 2728
我寻月下人不归
我寻月下人不归 2020-11-22 01:36

What is the best way (performance wise) to paginate results in SQL Server 2000, 2005, 2008, 2012 if you also want to get the total number of results (before paginating)?

19条回答
  •  不要未来只要你来
    2020-11-22 02:07

    You didn't specify the language nor which driver you are using. Therefore I'm describing it abstractly.

    • Create a scrollable resultset / dataset. This required a primary on the table(s)
    • jump to the end
    • request the row count
    • jump to the start of the page
    • scroll through the rows until the end of the page

提交回复
热议问题