Site icon Database Tutorials

The constraint ‘PK_X’ is being referenced by table ‘X’, foreign key constraint ‘FK_X’

 

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:

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.

Exit mobile version