问题描述
- 数据库里的触发器问题
-
数据库里的触发器,在触发器里面定义的变量,怎么在执行语句的时候给变量进行赋值create trigger yhh
on yue
for update
as
begin tran
declare @quqianjine int,@leixing char(5)
set @quqianjine=10002
set @leixing='支出'
if(@quqianjine>10000 )
begin
rollback tran
print'您的交易金额超出,不允许交易'
end
else
begin
commit tran
select name,moneyk,kid,类型=case
when @leixing='支出' then'支出'
when @leixing='存入' then'存入'
end
into p from yue where kid='1001'
endupdate yue set moneyk=moneyk-@quqianjine where kid='1001'
解决方案
http://dhp3s.blog.sohu.com/9408958.html
解决方案二:
http://blog.csdn.net/chinayuan/article/details/6292335/
解决方案三:
数据库里的触发器,在触发器里面定义的变量,怎么在执行语句的时候给变量进行赋值
set @leixing = '支出'
select '支出' into @leixing
解决方案四:
set @leixing = '支出'
select '支出' into @leixing