Adds a user-defined message to the SYSUSERMESSAGES system
table for use by PRINT and RAISERROR statements.
Syntax
CREATE MESSAGE <message-number>
... AS <'message-text'>
Parameters
(back to top)
- message_number the message number of the message to add. The
message number for a user-defined message must be 20000 or
greater.
- message_text he text of the message to add. The maximum
length is 255 bytes. PRINT and RAISERROR recognize placeholders in the
message text to print out. A single message can contain up to 20 unique
placeholders in any order. These placeholders are replaced with the
formatted contents of any arguments that follow the message when the text of
the message is sent to the client.
Placeholders are
numbered to allow reordering of the arguments when translating a message
to a language with a different grammatical structure. A placeholder for
an argument appears as “%nn!”—a percent sign (%), followed by an integer
from 1 to 20, followed by an exclamation mark (!)—where the integer
represents the position of the argument in the argument list, “%1!” is
the first argument, “%2!” is the second argument, and so
on.
Usage
(back to top)
CREATE MESSAGE associates a
message number with a message string. The message number can be used in PRINT and RAISERROR
statements.
There is no parameter corresponding to the <language> argument for sp_addmessage.
Standards
(back to top)
- SQL—Vendor extension to ISO/ANSI SQL grammar.
- SAP Database products—The functionality of
CREATE MESSAGE is provided by the
sp_addmessage procedure in SAP ASE.
Permissions
(back to top)
Requires
one of:
- CREATE MESSAGE system privilege.
- CREATE ANY OBJECT system privilege.