Sunday, March 11, 2012

Cascading Deletes

We have just upgraded from sql server 7 to sql server 2000.
The BOL talks about setting the cascading deletes
in different ways.
1. By setting the 'ON DELETE CASCADE' parameter of the
foreign key references clause in a Create Table or Alter Table
statement.
2. By Viewing the Manage Relationships Tab of the relationships
view in table design, and clicking on the 'Cascade Delete Related
Records' Checkbox.
Are these two methods the same thing?
1. talks about Contraints and 2. is refering to relaionships.
If they are not the same thing, How do I implement the cascade deletes
on existing tables, and on new tables?
Thank You for your help,
Laurence Nuttall
Programmer Analyst III
UCLA - Division of Continuing Educationthey are the same, as with ON UPDATE,
personally, i prefer to explictly delete the FK references
first, but that is just my preference so i don't delete
anything i didn't intend to, there are circumstance when
CASCADE ON UPDATE is required
>--Original Message--
>We have just upgraded from sql server 7 to sql server
2000.
>The BOL talks about setting the cascading deletes
>in different ways.
>1. By setting the 'ON DELETE CASCADE' parameter of the
> foreign key references clause in a Create Table or
Alter Table
> statement.
>2. By Viewing the Manage Relationships Tab of the
relationships
> view in table design, and clicking on the 'Cascade
Delete Related
> Records' Checkbox.
>
>Are these two methods the same thing?
>1. talks about Contraints and 2. is refering to
relaionships.
>If they are not the same thing, How do I implement the
cascade deletes
>on existing tables, and on new tables?
>Thank You for your help,
>Laurence Nuttall
>Programmer Analyst III
>UCLA - Division of Continuing Education
>
>.
>

No comments:

Post a Comment