Re: Adding Foreign Key Fails

2006-07-27 Thread Jesse
By that I hope you mean there is an index on confinvitems.InvDetID _and_ confinvdet.ID Yes, there is. Could be a record in confinvitems that has an InvDetID that doesn't exist in ConfInvDet. Check with something like: SELECT InvDetID FROM confinvitems WHERE InvDetID NOT IN (SELECT ID FROM Con

Re: Adding Foreign Key Fails

2006-07-27 Thread mark addison
On Wed, 2006-07-26 at 08:58 -0400, Jesse wrote: > 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`)

Re: Adding Foreign Key Fails

2006-07-26 Thread Jesse
Is this a InnoDB table. Yes, sorry, I should have mentioned that. The rest of my tables are MyISAM, and I discovered that it does not support Foreign Keys. So, I converted these tables to InnoDB so that I can put the Foreign Keys in. Thanks, Jesse -- MySQL General Mailing List For list

Re: Adding Foreign Key Fails

2006-07-26 Thread Dilipkumar
Hi, Is this a InnoDB table. Thanks & Regards Dilipkumar - Original Message - From: "Jesse" <[EMAIL PROTECTED]> To: "MySQL List" Sent: Wednesday, July 26, 2006 6:28 PM Subject: Adding Foreign Key Fails I am trying to add a foreign key to one of

Adding Foreign Key Fails

2006-07-26 Thread Jesse
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`) ON DELETE CASCADE; I get the error: MySQL Error Number