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 the purpose of a table?

959


How will you monitor replication latency in transactional replication? : sql server replication

1143


What is sqlservr.exe - process - sql server (sqlex?press)?

1108


Why transaction is important?

975


What is ssl in sql server?

1072


What are different types of roles provided by ssrs?

150


Can a function call a stored procedure in sql server?

960


What is 2nf normalization form?

1136


Why does sql studio use a single registered database repository? : sql server management studio

999


Explain four layers of abstraction microsoft architectured?

147


Other than truncate statement, which other command can by-pass the trigger on the tables?

1134


Which language rdl files made of?

130


Which operator do you use to return all of the rows from one query except rows are returned in a second query?

991


How do you send email on SQL Server?

1064


How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?

1208