/****** Object:  Trigger [TRG_PG_CRED_CONTROLE]    Script Date: 20/07/2016 13:57:54 ******/
IF  EXISTS (SELECT * FROM sys.triggers WHERE object_id = OBJECT_ID(N'[dbo].[TRG_PG_CRED_CONTROLE]'))
 DROP TRIGGER [dbo].[TRG_PG_CRED_CONTROLE]
 go
CREATE TRIGGER [dbo].[TRG_PG_CRED_CONTROLE] ON [dbo].[PG_CRED] FOR INSERT AS

--Caso nao tenha cadastro
INSERT INTO PG_CRED_CONTROLE
	(CD_EMP,
	CD_FILIAL,
	CD_PG_CRED)
SELECT DISTINCT 
	i.CD_EMP,
	i.CD_FILIAL,
	i.CD_PG_CRED
FROM
	INSERTED i 


