faqts : Computers : Databases : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 10 people (70%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Database: MySql: Error: 1216: (23000): Cannot add or update fails: a foreign key constraint fails

Jul 6th, 2008 13:21
Knud van Eeden, dman,


----------------------------------------------------------------------
--- Knud van Eeden --- 29 May 2005 - 10:34 pm ------------------------

Database: MySql: Error: 1216: (23000): Cannot add or update fails: a 
foreign key constraint fails

---

Possible cause:

You are trying to insert a not existing foreign key
(e.g. row nr 23)

---

Possible solution:

Check if the foreign key exists in the foreign key table.
If not, possibly insert it, or use another valid and existing
foreign key.

---
---

Internet: see also:

---

Database: Relational: MySql: Link: Overview: Can you give an overview 
of links?
http://www.faqts.com/knowledge_base/view.phtml/aid/35331/fid/52

----------------------------------------------------------------------