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!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.|||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.|||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?|||Sure can, but i need your help. What is the best way to get this information? I'm new to this... :p|||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.|||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...|||What DBMS are you using? What columns in the UNION table is the Foreign Key constraint 'Employee_FK00' referencing?|||I'm using MS SQL 2000...
What columns in the UNION table is the Foreign Key constraint 'Employee_FK00' referencing?
It is the Union# column.|||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#.|||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!|||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.
No comments:
Post a Comment