create proc pageproc
@pageIndex int,
@pageSize int
as
begin
declare cur cursor scroll for select stuName,stuno from stuInfo
declare @count int
declare @name varchar(20)
declare @no varchar(20)
set @count=(@pageIndex-1)*@pageSize+1
open cur
fetch absolute @count from cur into @name,@no
while @count<=@pageSize*@pageIndex and @@FETCH_STATUS=0
begin
print @name+' '+@no
set @count=@count+1
fetch absolute @count from cur into @name,@no
end
close cur
deallocate cur
end
go
SqlServer中使用游标实现分页效果
最新推荐文章于 2024-08-21 11:29:11 发布