Hello, I am trying to create a database table that links two records in another table. This is working okay but I have problems with cascade deletes on my foreign keys. A simplified version of the tables looks like this:CREATE TABLE [dbo].[tOtherTable]( [OtherTableID] [bigint] IDENTITY(1,1) NOT NULL, CONSTRAINT [PK_OtherTableID] PRIMARY KEY CLUSTERED ( [OtherTableID] ASC ))GOCREATE TABLE [dbo].[tConnections]( [ConnectionID] [bigint] IDENTITY(1,1) NOT NULL, [OtherTableFirstID] [bigint] NOT NULL, [OtherTableSecondID] [bigint] NOT NULL, CONSTRAINT [PK_ConnectionID] PRIMARY KEY CLUSTERED ( [ConnectionID] ASC ))GOALTER TABLE [dbo].[tConnections] WITH CHECK ADD CONSTRAINT [FK_tConnections_tOtherTable_OtherTableFirstID] FOREIGN KEY([OtherTableFirstID])REFERENCES [dbo].[tOtherTable] ([OtherTableID])ON DELETE CASCADEGOALTER TABLE [dbo].[tConnections] WITH CHECK ADD CONSTRAINT [FK_tConnections_tOtherTable_OtherTableSecondID] FOREIGN KEY([OtherTableSecondID])REFERENCES [dbo].[tOtherTable] ([OtherTableID])ON DELETE CASCADEGO
I have two foreign keys in tConnections referencing the same field in tOtherTable. When it tries to create the second foreign key it fails and is says it 'may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.' If I leave the cascade delete out of the second foreign key then it will create okay but if you try to delete from tOtherTable it can't because that violates the foreign key.Is there anyway I can make this work and still maintain database integrity?