question

venkatreddy avatar image
venkatreddy asked

what is ondelete cascade in sql server?

Hi, what is ondelete cascade in Sql Server, where it is useful? Can anybody give me an example?

sql-server-2005subjective
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

sp_lock avatar image
sp_lock answered

Try this link..

link

3 comments
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

+1, works so well when the results are totally relevant!
0 Likes 0 ·
-1 Do we really want users to go find the result somewhere else? Don't we want this forum to be the place where you can find the answer?
0 Likes 0 ·
@Hakan - yes, we do. But, we also want some recognition of the fact that we put our own time and effort into answering questions. I personally don't feel that the way the question is asked shows that respect.
0 Likes 0 ·
Kev Riley avatar image
Kev Riley answered

ON DELETE CASCADE is a clause that determines the action to be taken when a user tries to delete a key to which an existing foreign key points to.

Specifically, if an attempt is made to delete a row with a key referenced by foreign keys in existing rows in other tables, all rows that contain those foreign keys are also deleted.

Here is the MSDN page that describes (with examples) the various cascading referential integrity constraints.

10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.