/****** Object:  Trigger [TRG_EST_NF_ENT_PED_VD_EXCLUI_PENDENCIA]    Script Date: 13/10/2014 15:39:32 ******/
IF  EXISTS (SELECT * FROM SYS.TRIGGERS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[TRG_EST_NF_ENT_PED_VD_EXCLUI_PENDENCIA]'))
DROP TRIGGER [dbo].[TRG_EST_NF_ENT_PED_VD_EXCLUI_PENDENCIA]
GO
GO
-----------------------------------INSERÇÃO EM EST_NF_ENT_PED_VD-----------------------------------
CREATE TRIGGER [dbo].[TRG_EST_NF_ENT_PED_VD_EXCLUI_PENDENCIA] ON [dbo].[EST_NF_ENT_PED_VD] FOR INSERT AS
DELETE FROM p FROM EST_PED_VD_PENDENCIA p WHERE EXISTS
    (SELECT * FROM INSERTED WHERE CD_EMP=p.CD_EMP AND CD_FILIAL=p.CD_FILIAL AND CD_PED=p.CD_PED)
