Pages

Saturday, January 31, 2009

Delete two tables data same at a time

How to delete the data from two tables at the same time if they have common column?

There is NO direct method to do this. If the tables are having Parent-Child relationship then you need to delete the Child table first and delete the parent table.

If not you can define Trigger on Parent table and inside the trigger body write your code to delete the data from child table.

Or You can use CASCADE DELETE option at the KEY level to do this.

No comments: