According to the docs on RAISERROR:
Severity
Is the user-defined severity level associated with this message. When using msg_id
to raise a user-defined message created using sp_addmessage, the severity specified on RAISERROR
overrides the severity specified in sp_addmessage
.
Severity levels from 0 through 18 can be specified by any user. Severity levels from 19 through 25 can only be specified by members of the sysadmin fixed server role or users with ALTER TRACE
permissions. For severity levels from 19 through 25, the WITH LOG
option is required. Severity levels less than 0 are interpreted as 0. Severity levels greater than 25 are interpreted as 25.
State
Is an integer from 0 through 255. Negative values default to 1. Values larger than 255 should not be used.
If the same user-defined error is raised at multiple locations, using a unique state number for each location can help find which section of code is raising the errors.