PRINT command in SQL

In SQL Server, the PRINT command is used to return a message or the value of a variable to the output window, typically in SQL Server Management Studio (SSMS). It is commonly used for debugging or to provide feedback within stored procedures, functions, or scripts.

SQL

PRINT ‘Hello Ashish’;

This will print: Hello Ashish

We can also print the value of variables:

SQL

DECLARE @count INT = 10;
PRINT @count;

This will print: 10