IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_EST_NF_ENT_CANCEL_EST_NF_SAI]') AND parent_object_id = OBJECT_ID(N'[dbo].[EST_NF_ENT_CANCEL]'))
ALTER TABLE [dbo].[EST_NF_ENT_CANCEL] DROP CONSTRAINT [FK_EST_NF_ENT_CANCEL_EST_NF_SAI]
GO
GO

IF  EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'[dbo].[FK_EST_NF_ENT_CANCEL_EST_NF_ENT]') AND parent_object_id = OBJECT_ID(N'[dbo].[EST_NF_ENT_CANCEL]'))
ALTER TABLE [dbo].[EST_NF_ENT_CANCEL] DROP CONSTRAINT [FK_EST_NF_ENT_CANCEL_EST_NF_ENT]
GO
GO
ALTER TABLE [dbo].[EST_NF_ENT_CANCEL]  WITH CHECK ADD  CONSTRAINT [FK_EST_NF_ENT_CANCEL_EST_NF_ENT] FOREIGN KEY([CD_EMP], [CD_FILIAL], [CD_NF])
REFERENCES [dbo].[EST_NF_ENT] ([CD_EMP], [CD_FILIAL], [CD_NF])
GO

ALTER TABLE [dbo].[EST_NF_ENT_CANCEL] CHECK CONSTRAINT [FK_EST_NF_ENT_CANCEL_EST_NF_ENT]
GO


