分页存储过程

CREATE PROCEDURE PROC_FenYe
 @tableName varchar(50);
 @pageSize  int;
 @currentPage int
AS
SELECT TOP  @pageSize * FROM @tableName  
WHERE 
CR_Id  NOT IN
(SELECT TOP (@pageSize*(@currentPage-1)) CR_Id FROM @tableName  ORDER BY CR_Id)
ORDER BY CR_Id

posted @ 2015-02-26 17:35  EasyCms-  阅读(98)  评论(0编辑  收藏  举报