IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_RC_DEB_HISTORICO_CPL_RC_DEB]'))
begin
	ALTER TABLE [dbo].[RC_DEB_HISTORICO_CPL] DROP CONSTRAINT [FK_RC_DEB_HISTORICO_CPL_RC_DEB]
end
GO
GO
ALTER TABLE dbo.RC_DEB_HISTORICO_CPL ADD CONSTRAINT
	FK_RC_DEB_HISTORICO_CPL_RC_DEB FOREIGN KEY
	(
	CD_EMP,
	CD_FILIAL,
	CD_RC_DEB
	) REFERENCES dbo.RC_DEB
	(
	CD_EMP,
	CD_FILIAL,
	CD_RC_DEB
	) ON UPDATE  CASCADE 
	 ON DELETE  CASCADE 