非常NB的sql2005分页

declare @PageIndex as int
declare @PageSize as int
set @PageIndex = 4648
set @PageSize = 20

SELECT *
FROM
(SELECT ROW_NUMBER() OVER (ORDER BY pro_id DESC)AS Row, * FROM products_data) as list
WHERE Row between (@PageIndex - 1) * @PageSize + 1 and @PageIndex*@PageSize 

你可能感兴趣的:(sql2005)