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 code near application topology?

271


What are the system database in sql server 2008?

981


explain different types of joins? : Sql server database administration

929


What types of replication are supported in sql server?

1000


What are pessimistic lock and optimistic lock?

1003


what's the information that can be stored inside a bit column? : Sql server database administration

969


What is ms sql server service broker?

935


Explain what role entity and relationship play in an ER diagram.

1023


What are basics of policy management?

1055


Is null vs coalesce?

819


What is set nocount on?

899


What are extended events in sql server?

909


Explain the use of keyword with encryption. Create a store procedure with encryption?

898


How to loop through the result set with @@fetch_status?

1257


What is replication with database mirroring? : sql server database administration

989