日期:2012-12-27  浏览次数:20853 次

下面读取纪录的存储过程:<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