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

How many triggers are possible per table?

1072


What are the 3 types of schema?

1086


What is importing utility?

963


What are the advantages of stored procedure in sql server?

880


What is the difference between Clustered and Non-Clustered Index?

1043


How to connect to SQL Azure Database by using sqlcmd?

136


What is use of @@ spid in sql server?

1194


Explain timestamp datatype?

947


What is the maximum length of an alert name?

994


What is the partitioning method?

1001


What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture

979


How can delete duplicate records in cte in sql server?

950


Tell me something about security and sql azure?

114


What happens to a statement batch if there is a compilation error?

937


How to create a store procedure with encryption?

984