update觸發器
請問大家在做一個庫存管理中,出庫後庫存減少。如果要對出庫單進行修改,那麼庫存又怎麼增加和減少呢!!!!
------解决方案-----------------------amount 数量
create trigger Stock_update on 出库表
for update
as
update Stockamount
set amount=amount+(i.amount-d.amount)
from inserted i join deleted d
where
i.i.物品ID-d.物品ID
and Stockamount.物品ID=i.物品ID