Solved

Foreign Key Constraint Error?

Posted on 2015-01-21
6
64 Views
Last Modified: 2015-01-22
Please see Screenshot for error message.

I understand this error usually. But in this case I'm not sure. I'm basically trying to delete a record from table LKUP_UserAccounts where the PrimaryKey value is 9. The error says it conflicts with the "approvedBy_ID" column in the LKUP_UnitBaseConversions table. That tells me that at least one row in that table contains the value of 9 in the "approvedBy_ID" column. However, when I check the LKUP_UnitBaseConversions table....there are not rows where that value resides in that column. There are actually 3 different columns that could contains that value but in this case, 9 doesn't exist in any of the 3 columns.

What else could it be?

Thanks
Screenshot.JPG
0
Comment
Question by:BlakeMcKenna
  • 2
  • 2
6 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
Comment Utility
is it a direct referential integrity problem , or is the message coming from the action of a table/view trigger...

can you post the actual delete as coded , and the underlying table structures?
0
 
LVL 45

Accepted Solution

by:
Vitor Montalvão earned 500 total points
Comment Utility
By the error message you are trying to delete a user account that is referred in the column approvedBy_ID of the table LKUP_UnitBaseConversions, right?
How do you know is the value 9?
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
I actually stepped thru the code and at the point just before the data was stored, the value wasn't a 9 rather 0 which meant that value didn't reside in the other datatable. So, everything was working as it should....my bad!
0
 
LVL 45

Expert Comment

by:Vitor Montalvão
Comment Utility
The machine is always right :)
0
 

Author Comment

by:BlakeMcKenna
Comment Utility
I believe so....thanks for your input!
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now