Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 PRINT STATEMENT

Author  Topic 

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2013-06-21 : 14:50:13
I'm using a simple print statement in a stored procedure in SQL Server Express 2012, and it is my understanding that the statement is supposed to return printed text to the user. I cannot see the statement being returned, because it isn't popping up and I don't know where to look. Where should I see the what is supposed to be printed after I execute the stored procedure in SQL Management Studio?

Here is my stored procedure:
CREATE PROCEDURE pr_Names @VarPrice money
AS
BEGIN
-- The print statement returns text to the user
PRINT 'Products less than ' + CAST(@VarPrice AS varchar(10));
-- A second statement starts here
SELECT ProductName, Price FROM vw_Names
WHERE Price < @varPrice;
END
GO


Here is my execute statement:
EXECUTE pr_Names 10.00;
GO

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-06-21 : 14:53:35
If you are in grid mode then there are two tabs in the result pane (results and Messages).


Be One with the Optimizer
TG
Go to Top of Page

sfjtraps
Yak Posting Veteran

65 Posts

Posted - 2013-06-21 : 14:54:22
Thanks. I see it in Messages.
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-06-21 : 14:58:38
cool - have fun

Be One with the Optimizer
TG
Go to Top of Page
   

- Advertisement -