Returns a user-defined message to the client.
PRINT 'any ASCII text' | @local_variable | @@FUNCTION | string_expr
To print a user-defined error message having an the error number that can be returned by @@ERROR, use RAISERROR instead of PRINT.
This example uses the PRINT statement to conditionally return a message.
IF EXISTS (SELECT zip FROM authors WHERE zip = '94705')
PRINT 'Berkeley author'
This example converts the results of the GETDATE function to a varchar data type and concatenates it with literal text to be returned by PRINT.
PRINT 'This message was printed on ' +
RTRIM(CONVERT(varchar(30), GETDATE())) + '.'
Data Types | RAISERROR |
DECLARE @local_variable | Functions |