From: Mounilk on
Hi,
I need to find out if the cascade delete option is set on any of the
tables in my database. Any help is greatly appreciated.

Cheers
Mounilk
From: Erland Sommarskog on
Mounilk (mounilkadakia(a)hotmail.com) writes:
> I need to find out if the cascade delete option is set on any of the
> tables in my database. Any help is greatly appreciated.

Look up the catalog view sys.foreign_keys in Books Online.


--
Erland Sommarskog, SQL Server MVP, esquel(a)sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
From: Mounilk on
On Aug 2, 6:10 pm, Erland Sommarskog <esq...(a)sommarskog.se> wrote:
> Mounilk (mounilkada...(a)hotmail.com) writes:
> > I need to find out if the cascade delete option is set on any of the
> > tables in my database. Any help is greatly appreciated.
>
> Look up the catalog view sys.foreign_keys in Books Online.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...(a)sommarskog.se
>
> Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Hi Erland,
Thank you very much for your reply.

I checked the sys.foreign_keys view and for all the FK's in the db,
the value for delete_referential_action_desc field is 'NO_ACTION'. But
somehow, if i delete a parent record, the child record is being
deleted too. Is there any other place I can look for this?

Cheers,
Mounilk
From: Tom Cooper on
Probably you have a delete trigger on the table. Try running

Select name as triggername, OBJECT_NAME(parent_id) As tablename,* From
sys.triggers

to see if the table has triggers.

Tom

"Mounilk" <mounilkadakia(a)hotmail.com> wrote in message
news:0163b74b-418e-474c-a474-ea0d6a31ffcb(a)m17g2000prl.googlegroups.com...
On Aug 2, 6:10 pm, Erland Sommarskog <esq...(a)sommarskog.se> wrote:
> Mounilk (mounilkada...(a)hotmail.com) writes:
> > I need to find out if the cascade delete option is set on any of the
> > tables in my database. Any help is greatly appreciated.
>
> Look up the catalog view sys.foreign_keys in Books Online.
>
> --
> Erland Sommarskog, SQL Server MVP, esq...(a)sommarskog.se
>
> Books Online for SQL Server 2005
> athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
> Books Online for SQL Server 2000
> athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

Hi Erland,
Thank you very much for your reply.

I checked the sys.foreign_keys view and for all the FK's in the db,
the value for delete_referential_action_desc field is 'NO_ACTION'. But
somehow, if i delete a parent record, the child record is being
deleted too. Is there any other place I can look for this?

Cheers,
Mounilk