非常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 

posted @ 2009-06-16 16:47  小师傅  阅读(152)  评论(0编辑  收藏  举报