All SQL Server error codes can be found within the master.dbo.sysmessages system table. It is a good practice to store the value within a local variable. All errors raised by SQL Server return the following information. Number - Each error has a unique number assigned to it. Message - Contains information about the error.
Many errors have substitution variables that can be placed within the text.
Severity - Indicates how serious the error is. The values are between 1 and 25. For example, an 1105' error can be raised for several different conditions. A Microsoft support engineer can use the state code from an error to find the location in the source code where that error code is being raised, which may provide additional ideas on how to diagnose the problem. If the destruction occurred within a stored procedure, the name is returned.