Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Cascade delete

 
   Database Help (Home) -> Server RSS
Next:  Maintenance Plans in SQL 2005  
Author Message
Mounilk

External


Since: Aug 01, 2010
Posts: 2



(Msg. 1) Posted: Sun Aug 01, 2010 11:24 pm
Post subject: Cascade delete
Archived from groups: microsoft>public>sqlserver>server (more info?)

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

 >> Stay informed about: Cascade delete 
Back to top
Login to vote
Erland Sommarskog2

External


Since: May 30, 2004
Posts: 2061



(Msg. 2) Posted: Mon Aug 02, 2010 4:25 am
Post subject: Re: Cascade delete [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Mounilk ( ) 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 RemoveThis @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

 >> Stay informed about: Cascade delete 
Back to top
Login to vote
Mounilk

External


Since: Aug 01, 2010
Posts: 2



(Msg. 3) Posted: Mon Aug 02, 2010 4:31 pm
Post subject: Re: Cascade delete [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Aug 2, 6:10 pm, Erland Sommarskog wrote:
> Mounilk ( ) 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....RemoveThis@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
 >> Stay informed about: Cascade delete 
Back to top
Login to vote
Tom Cooper

External


Since: Mar 12, 2004
Posts: 8



(Msg. 4) Posted: Mon Aug 02, 2010 10:53 pm
Post subject: Re: Cascade delete [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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" wrote in message

On Aug 2, 6:10 pm, Erland Sommarskog wrote:
> Mounilk ( ) 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... RemoveThis @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
 >> Stay informed about: Cascade delete 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Cascade Update two FK from one PK - In an Inventory table, there are two foreign key fields referring the same primary key in an Account table. When I set the relationships on these tables to Cascade Update Related Fields for both foreing keys, I get an error: Introducing FOREIGN KEY..

cascade deleting on recursive relation - Hi how can i set a cascade delete for a recursive relation ? setting cascade delet to a normal PK FK Relation (2 Table) is no problem but for recursive relation are the fields in Relationships Dialog Box disabled. Thanks Jafar

"Multiple Cascade Paths Error in SQL Server" - Please tell me your oppinion on this: create table table1 (user_ID integer not null primary key, user_name char(50) not null) go create table table2 (author_ID integer not null primary key, author_name char(50) not null, lastModifiedBy integer not null,...

Help with a delete statement - Wondering if someone can show me the correct syntax of a delete statement where I want to delete rows from table 'A' where say column1 of table 'A' = column 1 of table 'B' and column 2 of table 'A' = column 2 of table 'B'. Working within a procedure an...

Delete sql - Hi, how can I do a SQL that deletes the records from 2 tables? example: tblCustomer: CodCust Name 1 John 2 Rambo 3 Bill Gates tblAddress: CodCust SellerCod 1 1 2 1 3 ...
   Database Help (Home) -> Server All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]