Monday , October 7 2024

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.

Loading

About dbtut

We are a team with over 10 years of database management and BI experience. Our Expertises: Oracle, SQL Server, PostgreSQL, MySQL, MongoDB, Elasticsearch, Kibana, Grafana.

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories