Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Answer Posted / dileep

Better you create a Trigger on child table like this one

CREATE TRIGGER trDelTrigger ON [dbo].[ChildTable]
FOR DELETE
AS
DELETE FROM ParentTable WHERE ParentTable.IdColumn=
(SELECT Deleted.IdColumn FROM Deleted)

Is This Answer Correct ?    9 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the new features of sql server 2012 reporting service?

133


What do we have to check in database testing?

1022


Can you explain important index characteristics?

993


What are different replication agents and what's their purpose? : sql server replication

1024


How to disable triggers using "disable trigger"?

1059


What is the difference between Triggers and Stored Procedure?

1098


What is a transaction and why is it important?

1092


 Explain what is sql override for a source taLle in a mapping?

1013


What do you understand by recursive stored procedure?

934


What is the maximum size per database for sql server express?

1058


What are the types of containers in ssis?

1172


How many servers can we create in a single subscription?

162


What are the differences between having and where clause.

967


Explain the stored procedure?

1056


How to stop log file growing too big?

1017