If there is a primary key foreign key relationship between two tables, you cannot delete the primary key without deleting the foreign key. When you want to delete you receive the error as follows.
Msg 3725, Level 16, State 0, Line 3
The constraint ‘PK_Person’ is being referenced by table ‘PersonDetails’, foreign key constraint ‘FK_PersonDetails_Person’.
Msg 3727, Level 16, State 0, Line 3
Could not drop constraint. See previous errors.
With TSQL:
1 2 3 4 | USE [TestDB] GO ALTER TABLE [dbo].[Person] DROP CONSTRAINT [PK_Person] WITH ( ONLINE = OFF ) GO |
Msg 3725, Level 16, State 0, Line 3
The constraint ” is being referenced by table ”, foreign key constraint ”.
Msg 3727, Level 16, State 0, Line 3
Could not drop constraint. See previous errors.