List:General Discussion« Previous MessageNext Message »
From:Dilipkumar Date:July 26 2006 1:24pm
Subject:Re: Adding Foreign Key Fails
View as plain text  

Is this a InnoDB table.

Thanks & Regards
----- Original Message ----- 
From: "Jesse" <jlc@stripped>
To: "MySQL List" <mysql@stripped>
Sent: Wednesday, July 26, 2006 6:28 PM
Subject: Adding Foreign Key Fails

>I am trying to add a foreign key to one of my tables. When I execute the 
>following SQL Code:
> ALTER TABLE `bpa`.`confinvitems` ADD CONSTRAINT `FK_confinvitems_1` 
> FOREIGN KEY `FK_confinvitems_1` (`InvDetID`)
> REFERENCES `confinvdet` (`ID`)
> I get the error:
> MySQL Error Number 1452
> Cannot add or update a child row: a foreign key constraint fails 
> (`bpa/#sql-162c_1b`, CONSTRAINT `FK_confinvitems_1` FOREIGN KEY 
> (`InvDetID`) REFERENCES `confinvdet` (`ID`) ON DELETE CASCADE)
> I have checked, and all the indexes seem to be in place, the data types 
> are exactly the same.  There are no duplicate ID's in the ConfInvDet 
> table.  Any idea what this error means, and how to fix it?
> Thanks,
> Jesse
> -- 
> MySQL General Mailing List
> For list archives:
> To unsubscribe: 

********** DISCLAIMER **********
Information contained and transmitted by this E-MAIL is proprietary to 
Sify Limited and is intended for use only by the individual or entity to 
which it is addressed, and may contain information that is privileged, 
confidential or exempt from disclosure under applicable law. If this is a 
forwarded message, the content of this E-MAIL may not have been sent with 
the authority of the Company. If you are not the intended recipient, an 
agent of the intended recipient or a  person responsible for delivering the 
information to the named recipient,  you are notified that any use, 
distribution, transmission, printing, copying or dissemination of this 
information in any way or in any manner is strictly prohibited. If you have 
received this communication in error, please delete this mail & notify us 
immediately at admin@stripped

Watch the latest updates on Mumbai, with video coverage of news, events,
Bollywood, live darshan from Siddhivinayak temple and more, only on

Watch the hottest videos from Bollywood, Fashion, News and more only on

Adding Foreign Key FailsJesse26 Jul
  • Re: Adding Foreign Key FailsDilipkumar26 Jul
  • Re: Adding Foreign Key FailsJesse26 Jul
  • Re: Adding Foreign Key Failsmark addison27 Jul
  • Re: Adding Foreign Key FailsJesse28 Jul