PRINT Statement [T-SQL]

Displays a message on the message window of the database server.

Syntax

PRINT format-string [, arg-list]

Examples

Usage

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 displays 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.

Standards

  • SQL—Transact-SQL extension to ISO/ANSI SQL grammar.

  • Sybase—Supported by Adaptive Server Enterprise.

Permissions

Must be connected to the database.

Related reference
MESSAGE Statement
LOGIN_PROCEDURE Option