Sql-server – pass data between stages in a maintenance task

maintenance-planssql serversql-server-2012

I have a Maintenance plan that I wish to execute nightly. The purpose is to set an archived bit against records that are more than 60 days old. This bit all works fine, however I'd like to log (and email an operator) about how many records were affected.

I have a stored proc that does all the heavy lifting, and it is defined in an execute T-SQL task with an out parameter that contains the number of records affected.)

So how do I pass that value to a notify task, or log it?

Best Answer

Using an SSIS expression on the Notify Operator task properties for the message subject or body, you can construct whatever you want from variables written earlier.