Ok. I've tried the trigger, but it didn't work.
I have Cascades from A to Linker and from B to Linker, Cascade from Users to A, No Action from Users to B.
My trigger is on Users and is as follows:
set ANSI_NULLS ON set QUOTED_IDENTIFIER ON go ALTER TRIGGER [trig_delUser] ON [dbo].[aspnet_Users] FOR DELETE AS SET NOCOUNT ON; DELETE FROM B WHERE B.UserId = Deleted.UserId
I get the exception: The DELETE statement conflicted with the REFERENCE constraint "FK_B_aspnet_Users"
I am working with a modified aspnetdb SQL database:
[Partial DB diagram][2]
I have cascade deletion on the B_Linker relationship and the A_Linker relationship and there doesn't seem to be any danger of cycles occuring.
When I delete a user, I would like all A entries and B entries to be deleted along with any associated linker entries; unfortunately, SQL mgmt studio will only let me put a cascade delete rule on EITHER aspnet_Users_A or aspnet_Users_B, not both.
What do I need to do?
Many Thanks.