CREATE
procedure
main_table_pwqzc
( @pagesize int ,
@pageindex int ,
@docount bit ,
@this_id int )
as
if ( @docount = 1 )
begin
select count (id) from luntan where this_id = @this_id
end
else
begin
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound = ( @pageindex - 1 ) * @pagesize
set @PageUpperBound = @PageLowerBound + @pagesize
create table #pageindex(id int identity ( 1 , 1 ) not null ,nid int )
set rowcount @PageUpperBound
insert into #pageindex(nid)
select id from luntan where this_id = @this_id order by reply_time desc
select O. *
from luntan O,#pageindex p
where O.id = p.nid and p.id > @PageLowerBound and p.id <= @PageUpperBound order by p.id
end
GO
( @pagesize int ,
@pageindex int ,
@docount bit ,
@this_id int )
as
if ( @docount = 1 )
begin
select count (id) from luntan where this_id = @this_id
end
else
begin
declare @PageLowerBound int
declare @PageUpperBound int
set @PageLowerBound = ( @pageindex - 1 ) * @pagesize
set @PageUpperBound = @PageLowerBound + @pagesize
create table #pageindex(id int identity ( 1 , 1 ) not null ,nid int )
set rowcount @PageUpperBound
insert into #pageindex(nid)
select id from luntan where this_id = @this_id order by reply_time desc
select O. *
from luntan O,#pageindex p
where O.id = p.nid and p.id > @PageLowerBound and p.id <= @PageUpperBound order by p.id
end
GO