–存储过程分页
go
alter proc Page_New
(
@PageIndex int,
@PageSize int,
@PageCount int out
)
as
begin
declare @count int --总条数
select top(@PageSize) * from (select ROW_NUMBER() over(order by d.Id) as num,* from DayWord d join DayType dt on d.Dtid = dt.Did) as temp where num>((@PageIndex-1)*@PageSize)
select @count = count(*) from DayWord d join DayType dt on d.Dtid = dt.Did
–计算总页数
set @PageCount = ceiling(@count1.0/@PageSize)
select @count = count() from DayWord d join DayType dt on d.Dtid = dt.Did
–计算总页数
set @PageCount = ceiling(@count*1.0/@PageSize)
end
go
declare @count int
exec Page_New 2,2,@count out
select @count