/****** Object:  Trigger [TRG_EST_NF_SAI_FISCAL_INCLUI_PENDENCIA]    Script Date: 13/08/2014 15:28:34 ******/
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[TRG_EST_NF_SAI_FISCAL_INCLUI_PENDENCIA]'))
DROP TRIGGER [dbo].[TRG_EST_NF_SAI_FISCAL_INCLUI_PENDENCIA]
GO
GO
GO
-------------------------------------INSERO EM EST_NF_SAI--------------------------------------
CREATE TRIGGER [dbo].[TRG_EST_NF_SAI_FISCAL_INCLUI_PENDENCIA] ON [dbo].[EST_NF_SAI] FOR INSERT AS
INSERT INTO EST_NF_SAI_FISCAL_ENVIO_PENDENTE (
	CD_EMP, 
	CD_FILIAL, 
	CD_NF,
	DT_CAD)
    SELECT 
		DISTINCT CD_EMP, 
		CD_FILIAL, 
		CD_NF,
		GETDATE()
    FROM 
		INSERTED

