Solved

Foreign Key Constraint Error?

Posted on 2015-01-21
6
78 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 51

Accepted Solution

by:
Vitor Montalvão earned 500 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 51

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

Long way back, we had to take help from third party tools in order to encrypt and decrypt data.  Gradually Microsoft understood the need for this feature and started to implement it by building functionality into SQL Server. Finally, with SQL 2008, …
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…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

631 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