Multiple Delete/Update Rules when multiple foreign keys reference one table:
Years after you asked this question, I had the same problem.
I have Currencies
and Products
tables (i simplified for sharing) in my database as in the diagram:

I needed to SET NULL
both columns BuyingCurrencyId
and SellingCurrencyId
when I delete a record from table Currencies
. SQL Server does not support multiple INSERT And UPDATE Specification
in a structure like this.
In this case, a temporary solution can be produced by adding a boolean IsDeleted
column to table Currencies
. But in a large database, even if the DeleteRule || UpdateRule
specifications is passed around with such a tricky solution in a table, it will definitely be necessary somewhere in the database.
I got the following conflict occurred in database error in all of the triggers I created before:

And finally I was able to solve the problem by creating the following trigger:
USE [FooBarDatabase]
GO
--DROP TRIGGER accounting.Currency_Delete_Trigger
--GO
CREATE TRIGGER accounting.Currency_Delete_Trigger
ON accounting.Currencies INSTEAD OF DELETE
AS BEGIN
UPDATE stock.Products
SET BuyingCurrencyId = NULL,
SellingCurrencyId = NULL
WHERE BuyingCurrencyId in (SELECT Id FROM deleted)
AND SellingCurrencyId in (SELECT Id FROM deleted);
DELETE accounting.Currencies
WHERE Id in (SELECT Id FROM deleted);
END
GO
ALTER TABLE [accounting].[Currencies]
ENABLE TRIGGER [Currency_Delete_Trigger]
GO