What is the best way to paginate results in SQL Server

前端 未结 19 2709
我寻月下人不归
我寻月下人不归 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 01:57

    This is a duplicate of the 2012 old SO question: efficient way to implement paging

    FROM [TableX] ORDER BY [FieldX] OFFSET 500 ROWS FETCH NEXT 100 ROWS ONLY

    Here the topic is discussed in greater details, and with alternate approaches.

提交回复
热议问题