create procedure select_replynum @thebbs_id int, @theuser_id int, @thereplycontent varchar(2000)
as
begin
declare @motif_id int
select @motif_id=motifid from LB_BBS where bbsid=@thebbs_id
insert into LB_Reply(bbsid,userid,replycontent,replytime) values(@thebbs_id,@theuser_id,@thereplycontent,getdate())
update LB_BBS set replynum=replynum+1 where bbsid=@thebbs_id
update LB_Motif set motifreplynum=motifreplynum+1 where motifid=@motif_id
end 请试试
as
begin
declare @motif_id int
select @motif_id=motifid from LB_BBS where bbsid=@thebbs_id
insert into LB_Reply(bbsid,userid,replycontent,replytime) values(@thebbs_id,@theuser_id,@thereplycontent,getdate())
update LB_BBS set replynum=replynum+1 where bbsid=@thebbs_id
update LB_Motif set motifreplynum=motifreplynum+1 where motifid=@motif_id
end 请试试
看看执行结果中 @motif_id 是不是为null?? , 根本就不存在那样的记录!!!