I'm trying to create a table that has a foreign key associating it with another table. I would like to use 'on update cascade' with the foreign key but can't get it to work.
I can use syntax like this:
Code:
fieldname int(11) Not Null References OtherTable(pkField) On Update Cascade
but, it simply doesn't work. You can insert records with invalid values in the foreign key field (meaning you can insert a value in this child table that doesn't exist in the table with the primary key) Also, you can have a valid value but when you delete the record with the primary key from the parent table the records in the child table with the foreign key are not deleted also, leaving you with some invalid foreign keys in the child table. (creating referential integrity problems)
Does MySQL support On Update Cascade? If so, can someone post some sample code so I can see the proper syntax to use.
Thanks.