存储过程分页

create PROCEDURE [dbo].[GetGoodsIDList]
 @siteID int,
 @pageSize int,
 @pageIndex int
 

AS
BEGIN

SELECT  ID FROM 

(
SELECT ROW_NUMBER() OVER(ORDER BY ID asc) AS NUM,ID FROM goods_products where siteid=@siteID
) TB
WHERE NUM>=@pageSize*(@pageIndex-1) AND NUM<= @pageSize*@pageIndex

END

posted @ 2012-03-02 14:47  咸鱼公子  Views(174)  Comments(0Edit  收藏  举报