RAISERROR Statement [T-SQL]

Allows user-defined errors to be signaled, and sends a message on the client.

Quick Links:

Go to Parameters

Go to Examples

Go to Usage

Go to Standards

Go to Permissions

Syntax

RAISERROR error-numberformat-string ] [, arg-list ]

Parameters

(back to top)

Examples

(back to top)

Usage

(back to top)

There is no comma between the error-number and the format-string parameters. The first item following a comma is interpreted as the first item in the argument list.

The extended values supported by the SQL Server or Adaptive Server RAISERROR statement are not supported in SAP Sybase IQ.

Intermediate RAISERROR status and code information is lost after the procedure terminates. If at return time an error occurs along with the RAISERROR, then the error information is returned and the RAISERROR information is lost. The application can query intermediate RAISERROR statuses by examining @@error global variable at different execution points.

Standards

(back to top)

  • SQL—Transact-SQL extension to ISO/ANSI SQL grammar.
  • SAP Sybase Database product—Supported by Adaptive Server.

Permissions

(back to top)

Must be connected to the database.

Related reference
CONTINUE_AFTER_RAISERROR Option [TSQL]
ON_TSQL_ERROR Option [TSQL]