What is the use of CASCADE CONSTRAINTS?
Answers were Sorted based on User's Feedback
Answer / naresh
If you specify this option, later when you delete a row in
the parent table, the database server also deletes any rows
associated with that row (foreign keys) in a child table.
The principal advantage to the cascading-deletes feature is
that it allows you to reduce the quantity of SQL statements
you need to perform delete actions.
Is This Answer Correct ? | 14 Yes | 0 No |
Answer / kunal sain
to drop the constraint from child table when dropping the
constraint from parent table.
Is This Answer Correct ? | 10 Yes | 1 No |
Answer / nitesh
It is mainly used in referential integrity constraints.
When you use primary key/candidate key of one relation(say,
r1) as foreign key in other relation(say, r2), you want
changes made to primary key/candidate key of r1 must reflect
in foreign key of r2. And this can be achieved by CASCADE
constraint.
eg. consider two relations account, branch(with primary key
branch_name)
create table account(.....
foreign key branch_name references branch
on delete cascade
on update cascade
..........)
Is This Answer Correct ? | 0 Yes | 0 No |
What is the Main Difference between ACCESS and SQL SERVER?
How to verify a user name with sqlcmd tool?
What is the filtered index?
What are the different types of sql server replication? : sql server replication
What is recursion? Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?
What do you understand by a view? What does the with check option clause for a view do?
Explain indexing and what are the advantages of it?
What are sql server functions?
what is the information that can be stored inside a bit column? : Sql server database administration
What is the latest version of microsoft sql server?
What is global temp table?
What is openrowset sql server?