删除操作不会影响到inserted,而只会在deleted中存放原记录的副本。
----------------------------------------------------------------------------------------
CREATE TRIGGER trr_OutBase_del  ON dbo.B_OutBase 
FOR DELETE
AS
update B_Base set PartNum = a.PartNum - b.PartNum from B_Base a, deleted b
where a.Base=b.Base and  a.Type = b.Type and a.PartName = b.PartName

解决方案 »

  1.   

    CREATE TRIGGER trr_OutBase_del  ON dbo.B_OutBase 
    FOR DELETE
    AS
    update B_Base set PartNum = a.PartNum - b.PartNum from B_Base a, deleted b
    where a.Base=b.Base and  a.Type = b.Type and a.PartName = b.PartName
      

  2.   

    CREATE TRIGGER trr_OutBase_del  ON dbo.B_OutBase 
    FOR DELETE
    AS
    update B_Base set PartNum = a.PartNum - b.PartNum from B_Base a, deleted b
    where a.Base=b.Base and  a.Type = b.Type and a.PartName = b.PartName