Reference Manual
CHAPTER 9. SQL Statements
To display a message.
MESSAGE expression, ...
[ TYPE { INFO | ACTION | WARNING | STATUS } ]
[ TO { CLIENT | CONSOLE | LOG }]
Must be connected to the database.
None.
The MESSAGE statement displays a message, which can be any expression. Clauses can specify where the message is displayed.
Valid expressions can include a quoted string or other constant, variable, or function. However, queries are not permitted in the output of a Message statement even though the definition of an expression includes queries.
TYPE clause The TYPE clause only has an effect if the message is sent to the client. The client application must decide how to handle the message. Interactive SQL displays messages in the following locations:
INFO The Message window.
ACTION A Message box with an OK button.
WARNING A Message box with an OK button.
STATUS The Message window.
TO clause This clause specifies the destination of a message:
The default is CONSOLE, which means the database server window.
A destination of LOG sends messages to the server log file specified by the -o command-line option.
A destination of CLIENT sends messages to the client application. Your application must decide how to handle the message, and you can use the TYPE as information on which to base that decision.
SQL/92 Vendor extension.
Sybase Not supported in Adaptive Server Enterprise. The Transact-SQL PRINT statement provides a similar feature, and is also available in Adaptive Server Anywhere.
The following procedure displays a message on the server message window:
CREATE PROCEDURE message_test () BEGIN MESSAGE 'The current date and time: ', Now(); END
The statement:
CALL message_test()
displays the string The current date and time, and the current date and time, on the database server message window.