Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have inherited an old database which wasn't designed very well. It is a Sql Server 2008 database which is missing quite a lot of Foreign Key relationships. Below shows two of the tables, and I am trying to manually create a FK relationship between dbo.app_status.status_id and dbo.app_additional_info.application_id

enter image description here

I am using SQL Server Management Studio when trying to create the relationship using the query below

USE myDatabase; 
GO ALTER TABLE dbo.app_additional_info 
ADD CONSTRAINT FK_AddInfo_AppStatus FOREIGN KEY (application_id) 
    REFERENCES dbo.app_status (status_id) 

However, I receive this error when I run the query

The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_AddInfo_AppStatus". The conflict occurred in database "myDatabase", table "dbo.app_status", column 'status_id'.

I am wondering if the query is failing because each table already contains approximately 130,000 records?

share|improve this question
up vote 0 down vote accepted

The problem was there were some records in the child table that do not have a matching ID in the parent table.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.