Wednesday 19 October 2011

Restricted Vs. Cascade+Restricted

 When we discuss about delete actions , it is very confusing Restricted/Casecade+Restricted . I am trying to explain here :
Suppose we have 3 table , table1 , table2 , table3 .

Scenario 1 :
Table1 is having a restricted delete actions with table2 and table3 is having a cascade delete action with table1.
Now if we try to delete the record in table3 , and if record exists in table2 , we will get error
"The record may not be deleted. Transactions exist in table 'Table2'."

Scenario 2:

Table1 is having a cascade + restricted delete actions with table2 and table3 is having a cascade delete action with table1.
Now if we try to delete the record in table3 , and if record exists in table2, records will be deleted from table 3 , table 1 and table 2 as well.

One more thing , if you will try to delete the data from table1 and record exist in table2 , you cannot delete the  data in table1 (now cascade + restricted will behave like restricted)




Will be back soon,
Thanks

No comments:

Post a Comment