Result pane – messages tab | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Result pane – messages tab

Just wondering if there was an easy way to send messages that normally show up in the messages tab under the results pane to a text file. I have a T-SQL script written that uses print statements. I would like to run the script as a step in a maintenance plan and have the print statements show up in the log file. Is there an easy way to do this? Thanks,
If you are scheduling that as a job you can append or export the actions to a log file under SQLAgent –> Job. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
Thanks Satya, I’m actually already doing that but for some reason the print statements are not showing up in the file. If I run them interactively through a query window they show up fine. It’s only when I run them through the SQL Agent that the messages no longer show up. The log file is being created but no details. I’m starting to think I just may rebuild the job through the wizard and then modify the sql and see if they start logging. I no that shouldn’t make a difference but I can’t see any reason why those print statements are not getting logged in the log file. Following is all the log file produces: Microsoft(R) Server Maintenance Utility (Unicode) Version 9.0.2047
Report was generated on…
Maintenance Plan: …
Duration: 00:00:00
Status: Succeeded.
Details: I know the duration is 00:00:00 but it is a very quick job and that is all it takes when I run it through a query window as well. I’m testing on a very small database. Thanks again,