How to write query to Delete the records in child table
and corresponding records in parent table

Answer Posted / chaitanya

***********
Delete from P_table where P_Id=C_Id
***********

This is only aplicable if you have defined the foreign key
in the child table with the constraint on Delete Cascade.
Else you will get a Integration error.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Difference between aggregate functions of sql?

834


Please differentiate between a local and a global temporary table?

755


What is the command used to check locks in microsoft sql server?

718


What are the advantages of using stored procedures?

686


Can I use sql azure as a backup with log shipping or database mirroring?

148






How many types of database relationship in sql server?

755


In case you have filters in your report, when filters will be applied in cached report instance?

91


Explain triggers?

754


Can you explain what are the restrictions applicable while creating views? : SQL Server Architecture

653


What is the difference between value type and reference type?

707


What stored by the master? : sql server database administration

747


What is ems sql management studio? : sql server management studio

758


Do you know what are different types of replication in sql server?

734


What are the new features of sql server 2008 r2 reporting service?

124


What happens if you delete a table that is used by a view?

750