首页 > 其他 > 详细

分页存储过程

时间:2018-06-01 00:03:59      阅读:297      评论:0      收藏:0      [点我收藏+]

create proc Usp_getDatabyPage
@PageSize int,
@PageIndex int,
@PageCount int output
as
begin
select * from
(
select
*,
Rn=row_number() over(order by Tid asc)
from MyTable1
)as TblMyTable1
where TblMyTable1.Rn between (@PageIndex-1)*@PageSize+1 and @PageIndex*@PageSize

declare @rdCount int
select @rdCount=count(*) from MyTable1
set @PageCount =ceiling(@rdCount/(@PageSize*1.0))
end

分页存储过程

原文:https://www.cnblogs.com/liuhonghui/p/9119652.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!