Integrity Constraint Violation

From NeoWiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 10:51, 23 August 2008 (edit)
( | contribs)
(Integrity Constraint Violation)
← Previous diff
Current revision (20:44, 24 August 2008) (edit) (undo)
Sardisson (Talk | contribs)
(add hidden botlangbar stub for translators)
 
(One intermediate revision not shown.)
Line 1: Line 1:
-==Integrity Constraint Violation==+==Description==
 + 
 +This error message appears in [[NeoBase]].
-* Explanation 
The full text will be something like this: The full text will be something like this:
'''Integrity constraint violation - no parent 4, table: Table A in statement [ALTER TABLE "Table A" ADD FOREIGN KEY ("field name A") REFERENCES "Table B" ("field name B")''' '''Integrity constraint violation - no parent 4, table: Table A in statement [ALTER TABLE "Table A" ADD FOREIGN KEY ("field name A") REFERENCES "Table B" ("field name B")'''
 +
 +==Cause==
It occurs when you are trying to relate Table A to Table B by means of the two fields named. The field from table A ("field name A") is called a Foreign Key (FK). Any field that links into another table (Table B, in this case) is called a Foreign Key. Remember that every table must have its own Primary Key (PK) It occurs when you are trying to relate Table A to Table B by means of the two fields named. The field from table A ("field name A") is called a Foreign Key (FK). Any field that links into another table (Table B, in this case) is called a Foreign Key. Remember that every table must have its own Primary Key (PK)
Line 10: Line 13:
It means that there is data in field name A on one of the records in Table A that does not match any of the data in field name B on the records in Table B. It means that there is data in field name A on one of the records in Table A that does not match any of the data in field name B on the records in Table B.
-** Solution+==Solution==
Check your data. Make certain that every record in table A has a value in field name A that can be matched to an instance of field name B. Check your data. Make certain that every record in table A has a value in field name A that can be matched to an instance of field name B.
Line 30: Line 33:
|} |}
The problem with the data frequently occurs when test data is entered by hand and it's hard to keep track of the automatically created Primary Keys. The problem with the data frequently occurs when test data is entered by hand and it's hard to keep track of the automatically created Primary Keys.
 +
 +<!--{{botlangbarEN|}}-->
 +[[Category:NeoOffice]][[Category:Error Messages]]

Current revision

Description

This error message appears in NeoBase.

The full text will be something like this:

Integrity constraint violation - no parent 4, table: Table A in statement [ALTER TABLE "Table A" ADD FOREIGN KEY ("field name A") REFERENCES "Table B" ("field name B")

Cause

It occurs when you are trying to relate Table A to Table B by means of the two fields named. The field from table A ("field name A") is called a Foreign Key (FK). Any field that links into another table (Table B, in this case) is called a Foreign Key. Remember that every table must have its own Primary Key (PK)

It means that there is data in field name A on one of the records in Table A that does not match any of the data in field name B on the records in Table B.

Solution

Check your data. Make certain that every record in table A has a value in field name A that can be matched to an instance of field name B.

An example:

Table A = Purchases field name A = customer number
Table B = Customers field name B = customer ID
customer number customer ID
0 3
1 4
2 5

The problem with the data frequently occurs when test data is entered by hand and it's hard to keep track of the automatically created Primary Keys.

Personal tools