分页存储过程
程序员文章站
2022-06-24 15:19:12
create proc Usp_getDatabyPage@PageSize int,@PageIndex int,@PageCount int outputasbegin select * from ( select *, Rn=row_number() over(order by Tid asc ......
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
上一篇: 怎样快速填补大数据人才空缺
下一篇: 阿里巴巴早期发展简史之二