Wednesday, May 4, 2011

SQL Server : CASCADE




You don't have to give ON DELETE CASCADE or ON UPDATE CASCADE to foreign key. Basically, this is given on the primary key to say that if the record (in primary key table) is deleted or updated, reflect the changes in all the tables where the primary key table is referenced via foriegn key.

The advantage for cascading is that you don't have to do any checking and programming to avoid data inconstency. Disadvantage is that you don't have any control about the updates/deletes of the related records




No comments:

Post a Comment