IF EXISTS( SELECT * FROM SYS.OBJECTS 
			WHERE NAME ='TRG_PDV_CUPOM_NAO_FISCAL_EST_RPS_EXCLUI_PENDENCIA'AND TYPE = 'TR')
BEGIN
	DROP TRIGGER dbo.TRG_PDV_CUPOM_NAO_FISCAL_EST_RPS_EXCLUI_PENDENCIA 
END
GO
CREATE TRIGGER [dbo].[TRG_PDV_CUPOM_NAO_FISCAL_EST_RPS_EXCLUI_PENDENCIA] ON [dbo].[PDV_CUPOM_NAO_FISCAL_EST_RPS] FOR  INSERT AS
BEGIN
	DELETE p
		FROM PDV_CUPOM_NAO_FISCAL_RPS_PEND p 
		INNER JOIN INSERTED i ON
		p.CD_EMP = i.CD_EMP AND
		P.CD_FILIAL = I.CD_FILIAL AND
		P.CD_CTR = I.CD_CTR 
END