// SQL Server error reference

SQL Server error 3616: Error raised during trigger execution

An error inside a trigger aborted the batch and rolled back the user's transaction. The trigger's own error message comes just before this one.

Error number
3616
Severity
16
Category
Transactions and locking
Error message
An error was raised during trigger execution. The batch has been aborted and the user transaction, if any, has been rolled back.

What it means

When an error occurs inside a trigger, SQL Server (with the default XACT_ABORT behavior in triggers) aborts the batch and rolls back the whole transaction, including the statement that fired the trigger. Error 3616 reports that, after the trigger's actual error.

Common causes

  • The trigger raised an error on purpose with THROW or RAISERROR to reject a change.
  • A bug in the trigger, such as a constraint violation or conversion error in the table it writes to.
  • A trigger written for one row that fails on multi-row statements.

How to fix it

  1. Read the error above 3616; it is the one to fix.

  2. List the triggers on the table and review the one that failed.

    SELECT t.name, OBJECT_DEFINITION(t.object_id) AS definition
    FROM sys.triggers AS t WHERE t.parent_id = OBJECT_ID(N'dbo.Orders');
  3. Make triggers set-based so they work for any number of rows in inserted and deleted.

Related errors

More transactions and locking errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.