[求助]触发器看看错在哪
CREATE trigger TR1 ON 存取款单
for insert
as
if (select 存取标志 from inserted )=1
begin
update 储户
set 存款额=存款额+存取金额
from 储户 as a,inserted as b
where a.帐号=b.帐号
end
if (select 存取标志 from inserted)=0
begin
update 储户
set 存款额=存款额-存取金额
from 储户 as a,inserted as b
where a.帐号=b.帐号
end
if (select 储户.存款额 from 储户,inserted where inserted.帐号=储户.帐号)<(select inserted.存取金额 from inserted)
begin
print '该用户金额不足,不能再取款'
rollback transaction
end
其中
print '该用户金额不足,不能再取款' 这句是不是有问题?为什么当取款比存款额多是,不会报错