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
What is a non equi join?
What are the different Topologies in which Replication can be configured?
What is change data capture (cdc) in sql server 2008?
What are the differences between user defined functions and stored procedures?
What is the maximum number of instances in 32 bit and 64 bit sql server 2012?
Explain the benefits of user-defined functions?
What is filestream?
What do you understand by replication in sql server?
What is the full meaning of dml?
What is #temp and @table variable in SQL server?
How to create a store procedure with encryption?
What is thr feature of change data capture?
Define self join in sql server joins?
What are the source of constraints?
Can an entity have two primary keys?