SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER proc [dbo].[BIReport_GetAllReport_Page]
@currentpage int,--当前页码
@pagesize int --每页显示的条数
as
declare @beginindex int
declare @endindex int
begin
select @beginindex=(@currentpage-1)*@pagesize
select @endindex=@beginindex+@pagesize
end
begin
With X as --CTE递归
(
Select *, row_number() over(order by ReportId) as rowNum
From BIReport
)
select * from X
where rowNum between @beginindex+1 and @endindex
end