T-SQL 101: 94 Returning messages to the client by using PRINT and RAISERROR in T-SQL
There are times when you’re writing in any programming language, that you want to output messages back to the client. In T-SQL, the statement provided for that is the PRINT statement.
PRINT is simple enough to use. You give it a string to return and it prints that string.
It’s different to the SELECT statement, because the SELECT statement returns a rowset (i.e. a set of rows).
In the main image above, you can see a script with both a PRINT and a SELECT. When that script is executed, two things happen. The output of the SELECT statement is returned in the Results tab in SQL Server Management Studio as below:
2021-04-12