IF OBJECT_ID('jjp_CategoryList_Get') IS NOT NULL
DROP PROCEDURE jjp_CategoryList_Get;
GO
CREATE PROCEDURE jjp_CategoryList_Get
(
@pageIndex int,
@PageSize int,
@Records int output
)
AS
begin
with tmpTable as
(
select id, c1, c2 , row_number() over( order by id) as rownum from dbo.t1
)
select * from tmpTable where rownum between (@pageIndex-1)*@PageSize+1 and @PageIndex*@PageSize;
select @Records=count(*) from dbo.t1;
end