createprocup_GetForumList
as
selecta.id,a.rootid,a.fatherid,a.layer,a.title,a.topiccount,a.description,
UserID=b.id,b.UserName,b.Email,b.Homepage,b.Signature
fromforumasajoinBBSUserasbona.Masterid=b.IDorderbyrootid,layer
go
selectid,title,rootidfromforum
up_getforumlist
createprocup_InsertForum@a_strNamevarchar(50),@a_strDescriptionvarchar(255),@a_intFatherIDtinyint
as
/*界说部分变量*/
declare@intLayertinyint
declare@intRootIDtinyint
/*依据@a_intFatherID盘算layer,rootid*/
if(@a_intFatherID=0)
begin
select@intLayer=0
select@intRootID=0
end
else
begin
select@intLayer=1
select@intRootID=@a_intFatherID
end
InsertintoForum(rootid,layer,fatherid,title,description)
values(@intRootID,@intLayer,@a_intFatherID,@a_strName,@a_strDescription)
if(@a_intFatherID=0)
begin
select@intRootID=@@identity
updateForumsetrootid=@intRootIDwhereid=@intRootID
end
go