Click here to get back home

Foreign key on the same table update problem

 HomeNewsGroups | Search | About
 mailing.database.mysql    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Foreign key on the same table update problem nassim.bouayad.agha 11-15-2006
Get Chitika Premium
Posted by nassim.bouayad.agha on November 15, 2006, 9:25 am
Please log in for more thread options
Hello,
here is my table declaration :
CREATE TABLE staff_member(
pay_id varchar(64) NOT NULL default '',
manager_pay_id varchar(64),
location_name varchar(64),
first_name varchar(64) NOT NULL default '',
last_name varchar(64) NOT NULL default '',
e_mail varchar(64) NOT NULL default '',
primary key (pay_id),
FOREIGN KEY (manager_pay_id) REFERENCES staff(pay_id)
ON DELETE SET NULL
ON UPDATE CASCADE
,
FOREIGN KEY (location_name) REFERENCES locations(location_name)
ON DELETE SET NULL
ON UPDATE CASCADE,
type ENUM('Manager', 'Normal') NOT NULL default 'Normal',
is_instructor ENUM('N', 'Y') NOT NULL default 'N'
);
A staff member has the 'manager_pay_id' field that points to another
staff member ('pay_id').This works perfectly but when I try to update
the 'pay_id' of a staff member that is pointed by another staff_member,
the update fails with error 1451.This not append with delete.Any idea?
Thank you in advance.
Best regard.
Nassim.


Posted by nassim.bouayad.agha on November 17, 2006, 5:56 pm
Please log in for more thread options

nassim.bouayad.agha@gmail.com a =E9crit :

> Hello,
> here is my table declaration :
> CREATE TABLE staff_member(
> pay_id varchar(64) NOT NULL default '',
> manager_pay_id varchar(64),
> location_name varchar(64),
> first_name varchar(64) NOT NULL default '',
> last_name varchar(64) NOT NULL default '',
> e_mail varchar(64) NOT NULL default '',
> primary key (pay_id),
> FOREIGN KEY (manager_pay_id) REFERENCES staff(pay_id)
> ON DELETE SET NULL
> ON UPDATE CASCADE
> ,
> FOREIGN KEY (location_name) REFERENCES locations(location_name)
> ON DELETE SET NULL
> ON UPDATE CASCADE,
> type ENUM('Manager', 'Normal') NOT NULL default 'Normal',
> is_instructor ENUM('N', 'Y') NOT NULL default 'N'
> );
> A staff member has the 'manager_pay_id' field that points to another
> staff member ('pay_id').This works perfectly but when I try to update
> the 'pay_id' of a staff member that is pointed by another staff_member,
> the update fails with error 1451.This not append with delete.Any idea?
> Thank you in advance.
> Best regard.
> Nassim

Please,I need a quick response if possible!


Similar ThreadsPosted
Foreign key problem January 10, 2006, 8:11 am
Foreign Key Problem October 18, 2006, 1:38 pm
INSERT ID from foreign key table September 5, 2005, 12:28 am
REPOST : Urgent : Foreign key on the same table November 20, 2006, 4:01 pm
problem with foreign keys to datetime field September 15, 2005, 3:50 am
Update problem February 6, 2006, 6:33 pm
problem with update using join January 6, 2006, 3:26 am
How to UPDATE from a linked table October 6, 2005, 2:23 pm
update from select in same table December 7, 2005, 5:31 pm
Update a table with values in another January 18, 2006, 4:51 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap