sqlserver触发器添加条件if语句后不起作用,求解?
下面是触发器代码,不知问题出哪,update语句不执行,但如果把if语句"if(@t1>=@total)"去掉update语句就可执行了:altertriggertrBr...
下面是触发器代码,不知问题出哪,update语句不执行,但如果把if语句"if(@t1>=@total)"去掉update语句就可执行了:
alter trigger trBrowseInfo_I on tbBrowseInfo for insert
as
Begin
declare @u varchar(20),@total float,@t1 float
select @u=Publisher,@total=Price*Rest_Num from inserted
select @t1=Not_Withdraw_Total from tbUserInfo
if(@t1>=@total)
begin
update tbUserInfo set Not_Withdraw_Total=Not_Withdraw_Total-@total where UserName=@u
end
end 展开
alter trigger trBrowseInfo_I on tbBrowseInfo for insert
as
Begin
declare @u varchar(20),@total float,@t1 float
select @u=Publisher,@total=Price*Rest_Num from inserted
select @t1=Not_Withdraw_Total from tbUserInfo
if(@t1>=@total)
begin
update tbUserInfo set Not_Withdraw_Total=Not_Withdraw_Total-@total where UserName=@u
end
end 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询