Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Foreign Key Constraint Error?

Posted on 2015-01-21
6
Medium Priority
?
83 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
6 Comments
 
LVL 50

Expert Comment

by:Lowfatspread
ID: 40563362
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 52

Accepted Solution

by:
Vitor Montalvão earned 2000 total points
ID: 40563955
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
ID: 40564206
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 52

Expert Comment

by:Vitor Montalvão
ID: 40564213
The machine is always right :)
0
 

Author Comment

by:BlakeMcKenna
ID: 40564217
I believe so....thanks for your input!
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is basically a blog post I wrote recently. I've found that SARGability is poorly understood, and since many people don't read blogs, I figured I'd post it here as an article. SARGable is an adjective in SQL that means that an item can be fou…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

721 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