Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 deletion of parent and child table

Author  Topic 

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2008-02-28 : 06:58:45
how can we delete parent table as well as child table using a single query applied on parent table, can someone please help me onn this topic? it will be very nice of you guys.

Rahul Arora
07 Batch
NCCE Israna,


######################
IMPOSSIBLE = I+M+POSSIBLE

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2008-02-28 : 07:03:17
I assume you mean delete from the table and not drop the table?

Look up cascading deletes.
Go to Top of Page

arorarahul.0688
Posting Yak Master

125 Posts

Posted - 2008-02-28 : 07:07:30
quote:
Originally posted by RickD

I assume you mean delete from the table and not drop the table?

Look up cascading deletes.


yes delete from table

Rahul Arora
07 Batch
NCCE Israna,


######################
IMPOSSIBLE = I+M+POSSIBLE
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-02-28 : 07:26:59
Use ON DELETE CASCADE option when defining the foreign key relationship on the child table to parent table.
Go to Top of Page
   

- Advertisement -