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
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
THROWorRAISERRORto 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
-
Read the error above 3616; it is the one to fix.
-
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');
-
Make triggers set-based so they work for any number of rows in
insertedanddeleted.
Related errors
3609Transaction ended in the trigger512Subquery returned more than 1 valueORA-04088Oracle: error during execution of trigger
More transactions and locking errors
266Transaction count mismatch after EXECUTE1205Deadlocked and chosen as the victim1222Lock request time out period exceeded3930Transaction cannot be committed3902COMMIT has no corresponding BEGIN3903ROLLBACK has no corresponding BEGIN3960Snapshot isolation update conflict6401No transaction or savepoint found
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.
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.