sqlserver2000数据库中分页存储过程
create procedure PageSql(@pageindex int,@pagecount int,@tablename varchar(30),@keyname varchar(30))
as
declare @count int
declare @sqlstr varchar(1000)
select @count=(@pageindex-1)*@pagecount
set @sqlstr='select top '+cast(@pagecount as varchar)+
' * from '+@tablename+' where '+@keyname+
' not in (select top '+cast(@count as varchar)+
@keyname+' from '+@tablename+' order by '+@keyname+')
order by '+@keyname
exec (@sqlstr)