Is it possible to output values from a cascaded delete in SQL?
Something like:
DELETE [Families]
OUTPUT [deleted].[FamilyID] [deleted].[FamilyName], [Members].[MemberName]
FROM [Families]
LEFT JOIN [Members]
ON [Members].[FamilyID] = [Families].[FamilyID]
If there were two families with three total members, it should yield something like:
[FamilyID] [FamilyName] [MemberName]
12 'Family A' 'Member 1'
12 'Family A' 'Member 2'
13 'Family B' 'Member 3'
It is also acceptable for a solution to yield 1 row per family with the cascade-deleted members in a delimited list. Something like:
[FamilyID] [FamilyName] [MemberNames]
12 'Family A' 'Member 1|Member 2'
13 'Family B' 'Member 3'