CREATE trigger trigger_name on table1
for update asdeclare @zws_balance int , @zws_add intif update(zws1) /*座位数改变*/
begin
select @zws_add = table1.zws , @zws_balance = table2.zws2 where table1.mid = table2.mid and table1.mid in ( select mid from inserted )
if @zws_add > @zws_balance
begin
print '座位数不够'
rollback transaction
end
end
for update asdeclare @zws_balance int , @zws_add intif update(zws1) /*座位数改变*/
begin
select @zws_add = table1.zws , @zws_balance = table2.zws2 where table1.mid = table2.mid and table1.mid in ( select mid from inserted )
if @zws_add > @zws_balance
begin
print '座位数不够'
rollback transaction
end
end
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货