MySQL Forums
Forum List  »  InnoDB

Re: mySQL Errno:150 Foreign Key Problem. Please Help
Posted by: Leo Hopkins
Date: October 27, 2008 07:07AM

U have a slight issue in the 'create table' structure of the table "builds".
It shud b as follows :

create table builds(buildname varchar(15),
campaignname varchar(20),
adtype varchar(15),
complexity varchar(10),
category varchar(15),
FOREIGN KEY (campaignname) REFERENCES campaigns(campaignname) ON DELETE CASCADE,
PRIMARY KEY(buildname,campaignname));

Just note the positioning of the column in the primary key definition.

Wid this the following 'create table' command will work fine i.e.

create table tasks(campaignname varchar(20),
buildname varchar(15),
taskname varchar(15),
taskdetails varchar(50),
assignedto varchar(20),
dependenton varchar(15),
comments varchar(50),
lastupdate datetime,
PRIMARY KEY(taskname, buildname),
FOREIGN KEY (buildname) REFERENCES builds(buildname) ON DELETE CASCADE);

Hope it helps 4 u !!

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: mySQL Errno:150 Foreign Key Problem. Please Help
4703
October 27, 2008 07:07AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.