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 many triggers are possible per table?
What are the 3 types of schema?
What is importing utility?
What are the advantages of stored procedure in sql server?
What is the difference between Clustered and Non-Clustered Index?
How to connect to SQL Azure Database by using sqlcmd?
What is use of @@ spid in sql server?
Explain timestamp datatype?
What is the maximum length of an alert name?
What is the partitioning method?
What are the basic functions for master, msdb, model, tempdb and resource databases? : SQL Server Architecture
How can delete duplicate records in cte in sql server?
Tell me something about security and sql azure?
What happens to a statement batch if there is a compilation error?
How to create a store procedure with encryption?