sql分页存储过程

来源:互联网 发布:微信扫码群发软件下载 编辑:程序博客网 时间:2024/06/07 02:42
--编写存储过程,查询表中的总数据,及当前页的数据--pageindex,pagesizecreate proc GetPageList@pageIndex int,@pageSize  int,@rowCount int outputasbegin  SET NOCOUNT ON select @rowcount=COUNT(*)from StudentInfo where isDelete=0 select * from  (select *,ROW_NUMBER() over(order by sid asc) as rowIndex from StudentInfo where IsDelete =0)as t1 where rowIndex between (@pageIndex-1)*@pageSize and @pageSize*@pageIndexend

执行存储过程

declare @temp intexec GetPageList 1,5,@temp outputprint @temp
结果

0 0
原创粉丝点击