if exists(select * from sysobjects where ID = object_id(
drop proc up_TopicList
go
create proc up_TopicList
@a_ForumID int
as
declare @m_intRecordNumber int
declare @m_intStartRecord int
select @m_intRecordNumber = @a_intPageSize * @a_intPageNo
select @m_intStartRecord = @a_intPageSize * (@a_intPageNo
if @a_intDays =
begin
/*求符合條件記錄數*/
select
from BBS where Layer=
/*輸出紀錄*/
/*首先定義可滾動光標*/
set rowcount @m_intRecordNumber
declare m_curTemp Scroll cursor
for
select a
from BBS as b
where a
from BBS as c
where a
from BBS as a
join BBSUser as d on a
where Layer=
order by RootID desc
open m_curTemp
fetch absolute @m_intStartRecord from m_curTemp
while @@fetch_status =
fetch next from m_curTemp
set rowcount
/*清場*/
CLOSE m_curTemp
DEALLOCATE m_curTemp
end
else
begin
/*求符合條件記錄數*/
select
from BBS where Layer=
and dateadd(day
/*輸出紀錄*/
/*首先定義可滾動光標*/
set rowcount @m_intRecordNumber
declare m_curTemp Scroll cursor
for
select a
from BBS as b
where a
from BBS as c
where a
from BBS as a
join BBSUser as d on a
where Layer=
and dateadd(day
order by RootID desc
open m_curTemp
fetch absolute @m_intStartRecord from m_curTemp
while @@fetch_status =
fetch next from m_curTemp
set rowcount
/*清場*/
CLOSE m_curTemp
DEALLOCATE m_curTemp
end
go
注
From:http://tw.wingwit.com/Article/os/xtgl/201311/9080.html