Tuesday, March 27, 2012

Deleting record in table B on deleting record in table A using Trigger

I want to delete record in table B when i delete record in Table A both table have a common column. I want to do it using trigger .Can any body give some idea.
Table details are.

Table A:
Channel_ID, Name

Table B
User_Id,Channel_ID, Descriptionwithout using trigger
----------
1. You can choose ondelete cascade option in design mode of the table.
whenever u delete a record from table a the corresponding record from the table b will be deleted

using trigger
------
create a for delete trigger on table a.

delete from b where channel id........sql

No comments:

Post a Comment