Cascade Deletes not working!!!
Posted in 1997
Topics: Server Administration, Triggers, Constraints & Referential Integrity
Hello everybody...
I have the following two tables:
create table Products
(
productId char(20) primary key,
active int,
validPriceType char(20),
description char(80),
stockQty int
);
create table Attributes
(
productId char(20),
attribType char(20),
attribValue char(40),
attribPrice money,
attribPriceType char(20),
formType char(20),
sequence int,
primary key (productId, attribType, attribValue),
foreign key (productId) references Products (productIBd)
on delete cascade
);
...and yet when I run a simple delete query like:
delete from Products where productId = 'abc123' I get the followingmessage from dbaccess:
692: Key value for constraint (walker.u107_11) is still being referenced.
That's supposed to delete the record in Products and then delete the
corresponding row from Attributes, right? I don't understand!
Any help would be much appreciated :-)
Cheers,
-Robin