Chapter 9 SQL Statements
585
The CONTINUE_AFTER_RAISERROR database option is now deprecated
in favor of ON_TSQL_ERROR. The behavior of
CONTINUE_AFTER_RAISERROR is as follows. If it is set to ON, the
RAISERROR statement does not signal an error. Instead, the RAISERROR
status code and message are stored and the most recent RAISERROR is
returned when the procedure completes. If the procedure that caused the
RAISERROR was called from another procedure, the RAISERROR is not
returned until the outermost calling procedure terminates.
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.
♦
SQL/92 Transact-SQL extension.
♦
Sybase Supported by Adaptive Server Enterprise.
♦ The following statement raises error 23000, which is in the range for
user-defined errors, and sends a message to the client.
RAISERROR 23000 ’Invalid entry for this column:
%1!’, @val
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.
Standards and
compatibility
Example