SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Error quotes a non-existent FK constraint!
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

David Anderson
Starting Member

United Kingdom
8 Posts

Posted - 11/13/2012 :  06:33:21  Show Profile  Reply with Quote
I tried to create a new database diagram (with modified relationships) in one of my databases but got the following error message when I tried to save it.

'Entries' table
- Unable to create relationship 'FK_Entries_EntrySummary'.
The ALTER TABLE statement conflicted with the FOREIGN KEY constraint "FK_Entries_EntrySummary". The conflict occurred in database "sie-test", table "dbo.EntrySummary".

My problem is that I cannot find a FK constraint called "FK_Entries_EntrySummary" in my Entries table! It's not in the EntrySummary table either. Can anyone explain what might be happening here?

David

Edited by - David Anderson on 11/13/2012 11:06:41

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 11/14/2012 :  06:52:45  Show Profile  Reply with Quote
The error message is referencing the constraint you are trying to make...which is named "FK_Entries_EntrySummary", and it can't be created probably because there are some values in the EntrySummary table that doesn't comply with it.

Look in the EntrySummary table and see if you have any values there that are not present in the Entry-table.

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page

David Anderson
Starting Member

United Kingdom
8 Posts

Posted - 11/14/2012 :  07:29:56  Show Profile  Reply with Quote
Hi Lumbago,
You are absolutely correct! There were 3 very old orphaned records in my Entries table for which there was no matching record in the EntrySummary table. It just never occurred to me that the FK constraint causing the error was a new one I was trying to make. I just assumed the error referred to an existing constraint.

Problem now solved. Many thanks for your help!

David
Go to Top of Page

Lumbago
Norsk Yak Master

Norway
3271 Posts

Posted - 11/14/2012 :  08:37:38  Show Profile  Reply with Quote
Excellent :)

- Lumbago
My blog-> http://thefirstsql.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000