
IF EXISTS (SELECT 1 FROM sys.foreign_keys WHERE name = 'FK_T_EHR_RUS_13G5MCAGRS_T_EHR_RUS_BFQLSV25VP_EhrRusTree' AND parent_object_id = OBJECT_ID('EHR.T_EHR_RUS_BFQLSV25VP'))
ALTER TABLE EHR.T_EHR_RUS_BFQLSV25VP DROP CONSTRAINT FK_T_EHR_RUS_13G5MCAGRS_T_EHR_RUS_BFQLSV25VP_EhrRusTree
GO

IF NOT EXISTS (SELECT 1 FROM sys.foreign_keys WHERE name = 'FK_T_EHR_RUS_BFQLSV25VP_T_EHR_RUS_BFQLSV25VP_EhrRusTree' AND parent_object_id = OBJECT_ID('EHR.T_EHR_RUS_BFQLSV25VP'))
ALTER TABLE [EHR].[T_EHR_RUS_BFQLSV25VP] ADD CONSTRAINT [FK_T_EHR_RUS_BFQLSV25VP_T_EHR_RUS_BFQLSV25VP_EhrRusTree]
FOREIGN KEY([EhrRusTree]) REFERENCES [EHR].[T_EHR_RUS_BFQLSV25VP] ([EhrRusID])
GO
