create procedure paging
@NumPage int,
@CountRecOnPage int,
@CountRec int output
as
declare @low int, @high int
Set @CountRec=(select count(*) from id)
Set @low=@NumPage*@CountRecOnPage-@CountRecOnPage;
Set @high=@NumPage*@CountRecOnPage;
declare @t table
(IdTmp Char(10), NameTmp Char(10),
num int identity(1,1) not null)
insert into t (IdTmp, NameTmp) select * from id order by asc
select * from t where num between @low and @high
|