declare @pageSize int --返回一夜的记录数 declare @CurPage int --页号(第几页) declare @Count int declare @id int set @pageSize=10 set @CurPage =1 --定位 if @CurPage = -1 begin --最后一页 set rowcount @pageSize select @id=newsID from newsT
declare @pageSize int --返回一夜的记录数
declare @CurPage int --页号(第几页)
declare @Count int
declare @id int
set @pageSize=10
set @CurPage =1
--定位
if @CurPage = -1
begin
--最后一页
set rowcount @pageSize
select @id=newsID from newsTemp order by newsID
end
if @CurPage > 0
begin
set @Count = @pageSize * (@CurPage -1) + 1
set rowcount @Count
select @id=newsID from newsTemp order by newsID desc
end
--返回记录
set rowcount @pageSize
select * from newsTemp where newsID
set rowcount 0