--分页create table tb2
(
id int identity(1,1) primary key,
name varchar(10)
)insert tb2
select 'a'
union all
select 'b'
union all
select 'c'
union all
select 'd'
union all
select 'e'
union all
select 'f'
union all
select 'g'create procedure fenye(@pagesize int,@pageindex int)
as
declare @sql varchar(100)
set @sql='select top ' + cast(@pagesize as varchar(10)) + ' * from tb2 where not id in (select top ' + cast( (@pagesize*(@pageindex-1)) as varchar(10)) + ' id from tb2 order by id ) order by id'
exec(@sql)exec fenye 5,1drop procedure fenye
(
id int identity(1,1) primary key,
name varchar(10)
)insert tb2
select 'a'
union all
select 'b'
union all
select 'c'
union all
select 'd'
union all
select 'e'
union all
select 'f'
union all
select 'g'create procedure fenye(@pagesize int,@pageindex int)
as
declare @sql varchar(100)
set @sql='select top ' + cast(@pagesize as varchar(10)) + ' * from tb2 where not id in (select top ' + cast( (@pagesize*(@pageindex-1)) as varchar(10)) + ' id from tb2 order by id ) order by id'
exec(@sql)exec fenye 5,1drop procedure fenye
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货