Best paging solution using SQL Server 2005?

前端 未结 3 1514
别那么骄傲
别那么骄傲 2020-12-09 05:58

What is the most efficient paging solution using SQL Server 2005 against a table with around 5,000-10,000 rows? I\'ve seen several out there but nothing comparing them.

3条回答
  •  伪装坚强ぢ
    2020-12-09 06:52

    Even this should help..

    SELECT * FROM 
    ( 
        SELECT Row_Number() OVER(order by USER_ID) As RowID,
        COUNT (USER_ID) OVER (PARTITION BY null) AS TOTAL_ROWS, 
        select name from usertbl
    ) 
    As RowResults WHERE 
    RowID Between 0 AND 25
    

    Not sure if its better than @keith version.

提交回复
热议问题