Go Back   Cloud Computing > Support > MySQL Issues.
 

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 05-10-11, 06:53
BOD Member
 
Join Date: Apr 2011
Posts: 67
Default Reference key error in MySQL

Hi

I've a table X with a reference key of another table A. For a backup purpose I want to move the data from table A to table B. But while doing this, I've got the problem that the table X no more able to search entries in the table A and consistently returning a reference key error. Someone recommended me to remove foreign key from table X, but its not working. Can you suggest me a better solution?
Reply With Quote
  #2 (permalink)  
Old 05-10-11, 07:05
BOD Member
 
Join Date: Nov 2010
Posts: 104
Default

According to the MySQL's official website, both tables must not be temporary tables. Related columns in the foreign key and the referenced key must have the same internal data type inside Database so that they can be compared without a type conversion.
Reply With Quote
  #3 (permalink)  
Old 05-10-11, 07:06
paullopez's Avatar
Administrator
 
Join Date: Nov 2010
Posts: 195
Default

Probably you need to include two foreign key constraints, it would then take a firm stand into the parent row exist in both tables. You just need to reference the ID of table X in table B and A.
__________________
"I'm not anti-social; I'm just not user friendly"
Reply With Quote
  #4 (permalink)  
Old 05-10-11, 07:07
BOD Member
 
Join Date: May 2010
Posts: 149
Default

Technically it is possible. You just need to set two foreign keys for a table B and each foreign key need to point the required fields on one table. In simple words one foreign key per foreign table.
Reply With Quote
Reply


Thread Tools
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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off
Forum Jump


All times are GMT -6. The time now is 00:49.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
Copyright © 1999-2012, BODHost Ltd. All rights reserved.