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 the purpose of a table?
How will you monitor replication latency in transactional replication? : sql server replication
What is sqlservr.exe - process - sql server (sqlex?press)?
Why transaction is important?
What is ssl in sql server?
What are different types of roles provided by ssrs?
Can a function call a stored procedure in sql server?
What is 2nf normalization form?
Why does sql studio use a single registered database repository? : sql server management studio
Explain four layers of abstraction microsoft architectured?
Other than truncate statement, which other command can by-pass the trigger on the tables?
Which language rdl files made of?
Which operator do you use to return all of the rows from one query except rows are returned in a second query?
How do you send email on SQL Server?
How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?