日期:2014-05-17 浏览次数:20478 次
CREATE TRIGGER UPDATEQTY ON A AFTER UPDATE AS BEGIN UPDATE O SET O.notAlsoQty=O.louQty-O.alsoQty, FORM A O,INSERTED I WHERE O.ID=I.ID END CREATE TRIGGER UPDATECLOSET ON A AFTER UPDATE AS BEGIN UPDATE O SET O.isClose=1 FORM A O,INSERTED I WHERE O.ID=I.ID AND O.notaLSoQty<=0 END CREATE TRIGGER UPDATECLOSET2 ON A AFTER UPDATE AS BEGIN UPDATE O SET O.isClose=0 FORM A O,INSERTED I WHERE O.ID=I.ID AND O.notaLSoQty>0 END
UPDATE O SET O.notAlsoQty=O.louQty-O.alsoQty, O.isClose= (case when O.notaLSoQty>0 then 0 else 1 end ) FORM A O,INSERTED I WHERE O.ID=I.ID