mercredi 29 avril 2015

Set Foreign Key Column In Child Table To Null If Parent Foreign Key Deleted

I have an SQLite database.

I have learned how to insert a foreign key and now I would like to do this: 1. Delete the row which contains the foreign key in the parent table 2. Have any other table which references that foreign key set to null.

I have read about cascading deletes but that seems to delete any row which had that foreign key. Instead, I want to just null the value in any table that has a column value referencing the foreign key.

Can you advise what I can do to do this and perhaps what the terminology is?

Aucun commentaire:

Enregistrer un commentaire