ÏÂÃæ¶ÁÈ¡¼Í¼µÄ´æ´¢¹ý³Ì£º
if exists(select * from sysobjects where ID = object_id("up_GetTopic"))
drop proc up_GetTopic
go
create proc up_GetTopic @a_intID int
as
declare @m_intNextID int , @m_intProvID int , @m_intRootID int
declare @m_intLayer int , @m_intForumID int
select @m_intRootID = RootID , @m_intLayer = Layer , @m_intForumID = ForumID
From BBS where ID = @a_intID --ÇóÖ¸¶¨¼Ç¼RootID
if @@rowcount = 0 --Èç¹ûûÓÐÑ¡¶¨¼Í¼£¬ÔòÍ˳ö
return 0
select a.ID , a.Layer , a.ForumID , b.UserName , b.Email , b.ICQ , b.HomePage ,
a.Title , a.Content , a.PostTime , a.FaceID , a.Hits
from BBS as a
join BBSUser as b
on a.UserID = b.ID
where RootID = @m_intRootID and Layer >= @m_intLayer
order by RootID , OrderNum
/*¸üеã»÷Êý*/
update BBS Set Hits = Hits + 1 where ID = @a_intID
go

