Sql-server – Include stored procedure text output in the maintenance plan log

debuggingmaintenance-planssql serversql-server-2012

I have a maintenance plan subtask in SQL Server 2012 Enterprise that executes a stored procedure (or a SQL Server agent job).

In the log file for this maintenance plan, there are a few lines for this task, such as the start- and end- date, and the SQL statement used to execute the stored procedure.

Can I somehow generate text output in the stored procedure and have it included in the log?

It does not absolutely have to be part of the log file, but I would greatly prefer it that way. I would like to avoid another table which has to be separately cleaned up, backed up, documented, etc.

Best Answer

Does it have to be part of the log? You could just create a table and modify the stored procedure to store its output there.