How to fix Error 2113 on Windows Server 2025 / Windows 11

Troubleshooting Guide: SQL Server Error 2113 — INSTEAD OF Trigger Conflict with Cascading Foreign Key

Why This Error Happens

This error occurs because SQL Server 2025 does not allow you to create an INSTEAD OF DELETE or INSTEAD OF UPDATE trigger on a table that has a FOREIGN KEY constraint defined with ON DELETE CASCADE or ON UPDATE CASCADE. The engine blocks this combination because cascading actions and INSTEAD OF triggers both attempt to intercept and control the same DML operation, creating a logical conflict in how the modification should be processed. This is a schema design restriction, not a permissions or connectivity issue, and SQL Server will refuse the CREATE TRIGGER or ALTER TRIGGER statement outright until the conflicting constraint is resolved.

Step-by-Step Resolution Guide

Step 1: Identify the Conflicting Foreign Key Constraint

  • Run the following query to locate foreign keys with cascading actions on the target table:
SELECT fk.name AS ForeignKeyName, fk.delete_referential_action_desc, fk.update_referential_action_desc
FROM sys.foreign_keys fk
WHERE fk.parent_object_id = OBJECT_ID('YourSchema.YourTable');
  • Confirm whether delete_referential_action_desc or update_referential_action_desc shows CASCADE.

Step 2: Decide Between Removing Cascade or Removing the Trigger Type

  • If the business logic genuinely requires an INSTEAD OF trigger, you must drop the cascading behavior and move the cascade logic into the trigger itself.
  • If cascading is essential, consider switching from INSTEAD OF to an AFTER trigger instead, since AFTER triggers are compatible with cascading foreign keys.

Step 3: Modify the Foreign Key to Remove Cascading Behavior

  • Drop the existing constraint:
ALTER TABLE YourSchema.YourTable
DROP CONSTRAINT YourForeignKeyName;
  • Recreate it without the cascade option:
ALTER TABLE YourSchema.YourTable
ADD CONSTRAINT YourForeignKeyName
FOREIGN KEY (YourColumn) REFERENCES ReferencedTable(ReferencedColumn)
ON DELETE NO ACTION
ON UPDATE NO ACTION;

Step 4: Recreate the INSTEAD OF Trigger

  • With the cascade action removed, re-run your original CREATE TRIGGER statement for the INSTEAD OF DELETE or INSTEAD OF UPDATE trigger.
  • Manually embed the cascading delete/update logic inside the trigger body using DELETE/UPDATE statements against the child table referencing inserted and deleted virtual tables.

Step 5: Test the Trigger and Constraint Behavior

  • Execute a test DELETE or UPDATE against the parent table in a non-production environment.
  • Confirm child rows are handled as expected per your new trigger logic, since automatic cascading no longer applies.

Alternative or Verification Steps

  • Verify the fix by querying sys.triggers and sys.foreign_keys together to confirm no table has both an INSTEAD OF trigger and a cascading foreign key simultaneously.
  • If dropping the cascade isn’t feasible due to downstream dependencies, use an AFTER trigger combined with the existing cascading constraint as an alternative architecture that avoids Error 2113 entirely.