Export (0) Print
Expand All

Error Message Formats

SQL Server 2000

All of the Microsoft® SQL Server™ 2000 components can issue informational, warning, or error messages to applications. Most SQL Server messages returned to applications contain these parts:

  • Error number

    A one-to-five-digit number that identifies the message. Error numbers for user-defined messages can contain more digits.

  • Description

    A Unicode string that contains information about the condition that generated the message.

  • Severity level

    A one- or two-digit number that indicates the severity of the error condition.

  • State

    A one- to three-digit number with a maximum value of 127 that indicates to Microsoft support engineers and developers the location in the SQL Server code that generated the message:

  • Line number

    A number within the batch or stored procedure that contains the statement that generated the message. Line number can also be within the text of the stored procedure that is being executed.

The error numbers, descriptions, and severity levels for most SQL Server messages are stored in master.dbo.sysmessages. The state and line numbers are generated dynamically by the code issuing the message.

Messages raised in the client Net-Libraries, the Microsoft OLE DB Provider for SQL Server, or the SQL Server ODBC driver do not have some of these message parts.

To see an example of an error message, execute this statement:

SELECT * FROM ThisObjectDoesNotExist

This statement raises an error with these parts:

Error number: 208

Severity level: 16

State: 1

Line: 1

Description: Invalid object name 'ThisObjectDoesNotExist'.

All of the data APIs used by applications to access SQL Server return the error number and description. Not all of the APIs return the severity level, state, or line number. The Microsoft OLE DB Provider for SQL Server and the SQL Server ODBC driver return these parts only if an OLE DB or ODBC application has been written to use SQL Server-specific diagnostic features that are exposed by the provider and driver.

Show:
© 2015 Microsoft