If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > 547 error: help decoding

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-25-04, 11:32
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
547 error: help decoding

Can someone explain in more detail, or in plain english, what this error is trying to say.. ???

"An SQL error occured - 547 error: INSERT conflicted with column Foreign Key constraint 'Employee_FK00'. The conflict occured in database NAME, table 'Union', column 'UnionName'. "

I get this error aftering trying to add a new row in my .Net Winform i'm developing. Thanks!
Reply With Quote
  #2 (permalink)  
Old 08-25-04, 13:57
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
It looks like you are trying to insert a row in a child table without a parent row. Make sure that there is a row in the table that 'Employee_FK00' is referencing before you do the insert.
Reply With Quote
  #3 (permalink)  
Old 08-27-04, 14:01
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
Well.. more specifically, there are two tables 1. Employee and 2. tbl_Union. In the employee table there is Lastname, firstname, EmployeeID, and Union. All the different Unions are in the tbl_Union, with a Union# and Union Name field. Both tables have rows in them.

The vb.net Application was taking the Union# from the tbl_Union and inserted the value in Union under Employee. But i keep getting that SQL error.
Reply With Quote
  #4 (permalink)  
Old 08-27-04, 14:15
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
According to the error message, the foreign key is trying to match on UnionName, not Union#. Can you provide the DDL for the tables, including the foriegn key constraint definition?
Reply With Quote
  #5 (permalink)  
Old 08-27-04, 15:55
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
Sure can, but i need your help. What is the best way to get this information? I'm new to this...
Reply With Quote
  #6 (permalink)  
Old 08-28-04, 10:20
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
It depends. I just need the column names of the tables and the foreign key definition. I suspect that you are populating the union#, but for some reason, the foreign key is trying to point to UnionName.
Reply With Quote
  #7 (permalink)  
Old 08-30-04, 09:11
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
Well there is the "EMPLOYEE" table, which has fields Employee# (Primary Key), lastname, firstname, union. Then, there is the "UNION" table with fields, Union# (Foreign key), and UnionName. That's the basics...
Reply With Quote
  #8 (permalink)  
Old 08-30-04, 14:27
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
What DBMS are you using? What columns in the UNION table is the Foreign Key constraint 'Employee_FK00' referencing?
Reply With Quote
  #9 (permalink)  
Old 08-30-04, 14:45
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
I'm using MS SQL 2000....

Quote:
What columns in the UNION table is the Foreign Key constraint 'Employee_FK00' referencing?
It is the Union# column.
Reply With Quote
  #10 (permalink)  
Old 08-31-04, 09:47
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
I think you have your foriegn key defined incorrectly. If you look at the error message, it is trying to find a parent record with matching column 'UnionName' instead of Union#.
Reply With Quote
  #11 (permalink)  
Old 08-31-04, 12:40
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
Actually, that is a error on my part, its not the 'UnionName', but the 'Union#'. I typed that wrong in my original statement.

I'm currently in the SQL Server enterprise design area on the tables, looking at the indexes/keys tabs, etc. I guess this is the area I need to play in to figure it out. Thanks!
Reply With Quote
  #12 (permalink)  
Old 08-31-04, 14:34
hueby hueby is offline
Registered User
 
Join Date: Aug 2004
Location: STL
Posts: 45
I also found this thread that deals with the same situation I think.. http://www.dbforums.com/t700898.html

I did upgrade from access 2000 to ms sql as well, if that messed something up - I dont know.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On