Reference Manual
CHAPTER 9. SQL Statements
To display a message on the message window of the database server or return a message to the client window.
PRINT format-string [, arg-list]
Must be connected to the database.
None.
The PRINT statement returns a message to the client window if you are connected from an Open Client application or JDBC application. If you are connected from an Embedded SQL or ODBC application, the message is displayed on the database server window.
The format string can contain placeholders for the arguments in the optional argument list. These placeholders are of the form %nn!, where nn is an integer between 1 and 20.
SQL/92 Transact-SQL extension.
Sybase Supported by Adaptive Server Enterprise.
The following procedure displays a message on the server message window:
CREATE PROCEDURE print_test AS PRINT 'Procedure called successfully'
The statement
EXECUTE print_test
returns the string Procedure called successfully to the client.
The following statement illustrates the use of placeholders in the PRINT statement:
DECLARE @var1 INT, @var2 INT SELECT @var1 = 3, @var2 = 5 PRINT 'Variable 1 = %1!, Variable 2 = %2!', @var1, @var2