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 2005 Forums
 Transact-SQL (2005)
 Print question

Author  Topic 

revdnrdy
Posting Yak Master

220 Posts

Posted - 2010-01-06 : 17:32:41
Hello;

I have a question about the T-SQL PRINT syntax.

Lets say you have a procedure which executes and prints "SUCCESS" to the user screen. To make it easy presume the print statement is the only task in the procedure.

You schedule the task to run at midnight, well after you have shut down your SSMS tool and perhaps your pc.

The task runs.. My question is this: Where would the "SUCCESS" now be printed? There is no user screen available because you have shut down your system. My guess is the PRINT statement gets executed but the message is simply not printed anywhere for you to look at it.

Presume that the message is not printed to any table or output file. I realize those are viable alternatives to capturing print messages.

thanks for any replies.

revdnrdy

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-01-06 : 17:40:14
It goes into the job output if it is scheduled as a SQL Agent job.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-07 : 00:48:21
Usually when we create jobs for executing procedures we return the status as an int value (1-success,0-failure). then based on this return value we do the succeeding steps of job.
Go to Top of Page
   

- Advertisement -