if NOT exists(select 1 from sys.objects where object_id = object_id('FK_EST_NF_ENT_DAR_ERROS_VALIDACAO_EST_NF_ENT') )
BEGIN

ALTER TABLE dbo.EST_NF_ENT_DAR_ERROS_VALIDACAO ADD CONSTRAINT
	FK_EST_NF_ENT_DAR_ERROS_VALIDACAO_EST_NF_ENT FOREIGN KEY
	(
	CD_EMP,
	CD_FILIAL,
	CD_NF
	) REFERENCES dbo.EST_NF_ENT
	(
	CD_EMP,
	CD_FILIAL,
	CD_NF
	) ON UPDATE  NO ACTION 
	 ON DELETE  CASCADE 

END