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 cursors in ms sql server?

1173


write an SQL query to list the employees who joined in the month of January?

1676


What are the options which must be set to allow the usage of optimistic models?

961


How to disable a login name in ms sql server?

1129


What is shared lock?

896


Mention the differences between sql server and mysql.

1010


How to change the data type of an existing column with "alter table" statements in ms sql server?

980


Explain the first normal form(1nf)?

1022


Is it possible for a stored procedure to call itself or recursive stored procedure? How many levels of sp nesting are possible?

878


What are the differences between “row_number()”, “rank()” and “dense_rank()”?

1139


What is an example of a primary key?

981


Explain how does the report manager work in ssrs?

951


What is the recovery model? List the types of recovery model available in sql server?

900


What is dbcc updateusage?

1195


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

1005