小弟创建了一个触发器,但是在创建的时候提示else附近有语法错误,百思不得其解,请大哥大姐帮忙看看,多谢指教,本人较菜
CREATE TRIGGER trig_transInfo
ON transInfo
FOR insert
AS DECLARE @type char(10),@outMoney MONEY
DECLARE @myCardID char(50), @balance MONEY
select @type = transType,@outMoney=transMoney,@myCardID=cardID from inserted
if(@type = '支出')
update cardInfo set openMoney = openMoney - @outMoney
where cardID = @myCardID
update cardInfo set balance = balance - @outMoney 开始没有这句创建成功了
where cardID = @myCardID 开始没有这句创建成功了
else
update cardInfo set openMoney = openMoney + @outMoney
where cardID = @myCardID
update cardInfo set balance = balance + @outMoney 开始没有这句创建成功了
where cardID = @myCardID 开始没有这句创建成功了
[求助]触发器创建问题