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
How can you find out which stored procedures are recompiling?
How to create database with physical files specified in ms sql server?
How to populate a table in sql server?
What are drillthrough reports?
What is the difference between left and right outer join?
According to you what goes into making the best database administrator? : sql server database administration
what is the main function of a query parameter?
If a stored procedure is taking a table data type, how it looks?
What is inner join in sql server joins?
Define inner join? Explain with an example?
What is the name of reporting services config file and what’s it’s used for?
Will count(column) include columns with null values in its count?
Explain sql server service broker?
How can we rewrite sub-queries into simple select statements or with joins?
How to apply cascading referential integrity in place of triggers?