
Applies to SQL Server 2019, 2022 and 2025.
Every error SQL Server raises carries a number, a message, a state and a severity. Of those, the severity is the one I look at first, because the error severity levels tell you who is meant to deal with the problem: the person who wrote the query, or the DBA. They also decide whether your TRY…CATCH block ever sees the error, and whether the connection survives it.
The error severity levels in brief
Severity runs from 0 to 25. I think of it in four bands:
- 0 to 10: information. Not errors at all. Messages such as PRINT output, progress messages and warnings. SQL Server reports severity 10 to the client as 0.
- 11 to 16: errors the user can fix. A missing object (208 is severity 16), a permission denied (229, severity 14), a duplicate key (2627, severity 14), a deadlock victim (1205, severity 13), a syntax error (102, severity 15). Fix the query or the data and run it again.
- 17 to 19: resource and software problems. Out of space (1105 and the log-full error 9002 are both severity 17), an internal error that didn’t kill the statement (18), a limit in the engine that can’t be configured (19). The user can’t fix these. Someone needs to tell the DBA.
- 20 to 25: fatal errors. The batch stops, the connection is usually closed, and the error is written to the error log. Severity 21 to 24 can point to damage: 605 (severity 21) is a page that couldn’t be read, and 823 and 824 are severity 24. These need looking at straight away.
Testing which error severity levels reach CATCH
The quickest way to see the line between information and errors is to raise a message at a few severities inside TRY and record what happened:
CREATE TABLE #SeverityTest (Severity int PRIMARY KEY, Outcome varchar(30) NULL);
INSERT #SeverityTest (Severity) VALUES (0), (10), (11), (14), (16), (17), (18);
DECLARE @s int = (SELECT MIN(Severity) FROM #SeverityTest);
WHILE @s IS NOT NULL
BEGIN
BEGIN TRY
RAISERROR (N'Test message at severity %d', @s, 1, @s);
UPDATE #SeverityTest SET Outcome = 'carried on in TRY' WHERE Severity = @s;
END TRY
BEGIN CATCH
UPDATE #SeverityTest SET Outcome = 'jumped to CATCH' WHERE Severity = @s;
END CATCH;
SET @s = (SELECT MIN(Severity) FROM #SeverityTest WHERE Severity > @s);
END;
SELECT Severity, Outcome FROM #SeverityTest ORDER BY Severity;
DROP TABLE #SeverityTest;
On my SQL Server 2025 test instance, severities 0 and 10 carry on to the next statement in the TRY block, and 11 upwards jump to CATCH. That’s the rule: TRY…CATCH handles errors with a severity above 10 that don’t close the connection.
You can see how Microsoft spreads its own messages across the levels with sys.messages. Most are 16. The is_event_logged column marks the messages that are always written to the error log, whatever their severity:
SELECT severity,
COUNT(*) AS MessageCount,
SUM(CASE WHEN is_event_logged = 1 THEN 1 ELSE 0 END) AS AlwaysLogged
FROM sys.messages
WHERE language_id = 1033
GROUP BY severity
ORDER BY severity;
Raising your own errors
THROW always raises at severity 16, which is right for almost every business rule check. RAISERROR lets you pick the severity, which is handy for progress messages in long scripts:
RAISERROR (N'Step 3 of 5 done', 0, 1) WITH NOWAIT;
Severity 0 with NOWAIT sends the message to the client straight away instead of waiting for the output buffer to fill, so you can watch a long job move along in SSMS.
Severities 19 to 25 are restricted. Only members of sysadmin, or logins with ALTER TRACE permission, can use them, and they must add WITH LOG. Anyone else gets error 2754. A severity 20 or higher from RAISERROR closes the connection just as a real fatal error would, so don’t try it on a session you care about.
The common mistake
The mistake I see most is assuming that a CATCH block catches everything. It doesn’t. Messages at 10 and below pass straight through, which is usually fine. The bigger gap is at the top end: an error of severity 20 or above that closes the connection never reaches your CATCH block, because there is no session left to run it in. The same goes for an attention event such as a client timeout. So an error-logging table filled from CATCH will never record your most serious failures.
The second mistake is the opposite: raising your own validation errors at 17 or above because it “feels serious”. It isn’t a resource problem, and an Agent alert set up for 17 to 25 will start emailing the DBA every time a user types a bad date. Keep application errors at 16, and leave the high levels for the engine.
For the serious ones, use SQL Agent alerts on severities 17 to 25, plus 823, 824 and 825. They work from the logged error rather than the session, so they still fire when the session that hit the error is long gone. An alert only fires for an error that gets logged, and errors from 19 up always are. My Create Operator and Standard Alerts script sets those up, and Error Handling in Transactions covers the CATCH side.
Watch out for
- Severity 10 shows as 0 to the client application, so don’t test for 10 in client code.
- A deadlock (1205) is only severity 13. It goes to CATCH and the right response is usually to retry, not to call the DBA.
- Duplicate key and permission errors are severity 14, not 16. Check ERROR_NUMBER(), not ERROR_SEVERITY(), when you want to handle a particular error.
- RAISERROR with a severity above 25 is treated as 25.
- Severity 19 to 25 needs WITH LOG, and sysadmin or ALTER TRACE.
- Read the error log for anything at 17 or above, even if nobody complained.
Microsoft’s list of what each level means is on Learn: Database Engine error severities, and the restrictions on raising them are in the RAISERROR reference. There are more notes like this in my SQL Server DBA Handbook.
This topic came up in the SQLServerCentral Question of the Day: Severe Errors.
Clive Roberts DBA