trigger
-
I have two tables And i want to create a trigger so that when i delete a row from table1 the rows related to it from table2 should be deleted two. can you give some directions?(fot what table should i write the trigger?). Perhaps some one has a link with an example or something. Thank you!
-
I have two tables And i want to create a trigger so that when i delete a row from table1 the rows related to it from table2 should be deleted two. can you give some directions?(fot what table should i write the trigger?). Perhaps some one has a link with an example or something. Thank you!
Try the SQL forums. I'd do it as a stored procedure, that takes the data and deletes the right values from both rows, starting with the one that has the contraint that would otherwise be broken. Assuming you have added the necessary constraints so that users can't delete one table's data and orphan the other. Christian Graus - Microsoft MVP - C++
-
I have two tables And i want to create a trigger so that when i delete a row from table1 the rows related to it from table2 should be deleted two. can you give some directions?(fot what table should i write the trigger?). Perhaps some one has a link with an example or something. Thank you!
One table has to have a primary key which is a primary key or a foreign key of the second table. Your trigger should be such that upon the primary key tuple deletion from table 1 it also deletes assosicated tuples from table2 using primary key - foreign key relation. This will help you prevent dangling tuples. ---------- Venus Patel http://patelsinc.blogspot.com/ A student knows little about a lot. A professor knows a lot about little. I know everything about nothing.