Use of Cascade, Restricted and Cascade +Restricted (Delete action property for a table)
Example of Cascade
Suppose we have two tables (Customer & Order) and the relation is of One-To-Many i.e. Customer can have many orders
So on a parent table i.e.(Customer) if I set a delete action property to “CASCADE” for Order table. Then If I go and delete the record from a Customer table. It will also delete all the related records in Order table automatically
Example of Restricted
Suppose we have two tables (Customer & Order) and the relation is of One-To-Many i.e Customer can have many orders
So on a parent table i.e.(Customer) if I set a delete action property to “RESTRICTED” for Order table. Then If I go and delete the record from a Customer table. It will first check the record in the child table and if exist that warning prompt saying that first we need to delete a record from child table.
Example of Cascade + Restricted
Suppose we have three tables (Person ,Customer & Order) Now Person is a parent of Customer table, and Customer is a parent of Order table having (One-To-Many) relations
If I set a Delete action property on Person table to “CASCADE” for customer table and If I set a Delete Action property on a CUSTOMER table for Order table to “CASCADE +RESTRICTED”.
So if I delete a record from Customer table then It will first check the record in the child table(order table) and if exist that warning prompt saying that first we need to delete a record from child table.
But if I delete a record from Person table it will automatically delete a record in Customer table and all records related to customer table in Order table would also be deleted.
Informative blog.
ReplyDeleteMS Dynamics Online Training
Great read! I really enjoyed your perspective and found the information useful. It's always interesting to see how different industries and topics connect in unexpected ways. Thanks for sharing.
ReplyDeleteDental Implants In Madinaguda
This post is very useful for web developers working with ASP.NET. You explained how to bind a dropdown list using JSON and jQuery in a clear and simple way. The code example is easy to follow, and it worked perfectly in my project. Thank you for sharing such a practical and helpful guide. Looking forward to more tutorials like this on web technologies.
ReplyDeleteGenerative AI Training In Hyderabad