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 is difference between after and before?

1187


How do I view views in sql server?

1058


How can we solve concurrency problems?

1096


What does this statement do @@rowcount?

1014


Can you leave a union at any time?

1106


Which language rdl files made of?

141


Explain about SQLOS?

1057


List down some advantages of sql stored procedure?

1013


How to drop an existing table?

1049


What is equi join with example?

1224


What is thr feature of change data capture?

1031


Can we add an identity column to decimal datatype?

1040


Why do we backup Active Directory ?

1099


What is use of dbcc commands?

1121


Do you know what is user defined datatypes and when you should go for them?

1007