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 code near application topology?
What are the system database in sql server 2008?
explain different types of joins? : Sql server database administration
What types of replication are supported in sql server?
What are pessimistic lock and optimistic lock?
what's the information that can be stored inside a bit column? : Sql server database administration
What is ms sql server service broker?
Explain what role entity and relationship play in an ER diagram.
What are basics of policy management?
Is null vs coalesce?
What is set nocount on?
What are extended events in sql server?
Explain the use of keyword with encryption. Create a store procedure with encryption?
How to loop through the result set with @@fetch_status?
What is replication with database mirroring? : sql server database administration