ALL IN ONE:利用存储过程实现BBS树形结构的存储及有回复email通知功能的实现(三,完)
发表于:2007-06-30来源:作者:点击数:
标签:
下面读取纪录的存储过程:br br if exists(select * from sysobjects where ID = object_id(quot;up_GetTopicquot;))br nbsp;nbsp;nbsp;drop proc up_GetTopicbr gobr br create proc up_GetTopic @a_intID intbr nbsp;nbsp;nbsp;asbr nbsp;nbsp;nbsp;nbsp;nb
下面读取纪录的存储过程:<br>
<br>
if exists(select * from sysobjects where ID = object_id("up_GetTopic"))<br>
drop proc up_GetTopic<br>
go<br>
<br>
create proc up_GetTopic @a_intID int<br>
as<br>
declare @m_intNextID int , @m_intProvID int , @m_intRootID int<br>
declare @m_intLayer int , @m_intForumID int<br>
select @m_intRootID = RootID , @m_intLayer = Layer , @m_intForumID = ForumID<br>
From BBS where ID = @a_intID --求指定记录RootID<br>
<br>
if @@rowcount = 0 --如果没有选定纪录,则退出<br>
return 0 <br>
<br>
select a.ID , a.Layer , a.ForumID , b.UserName , b.Email , b.ICQ , b.HomePage ,<br>
a.Title , a.Content , a.PostTime , a.FaceID , a.Hits<br>
from BBS as a <br>
join BBSUser as b<br>
on a.UserID = b.ID<br>
where RootID = @m_intRootID and Layer >= @m_intLayer<br>
order by RootID , OrderNum<br>
<br>
/*更新点击数*/<br>
update BBS Set Hits = Hits + 1 where ID = @a_intID<br>
go
原文转自:http://www.ltesting.net