Sql-server – SQL Server 2014 DBCC CHECKDB notification

sql serversql server 2014

I want to include the results of DBCC CHECKDB in the notification email sent to me. I have seen some techniques in older versions of SQL Server. Is there any new / easier way to due this in SQL Server 2014?

Best Answer

  1. Create a Job Step next to the DBCC CHECKDB Step, and set the Checkdb Step field 'On success action' to 'Go to Next Step'
  2. In the Checkdb Step create an output file.
  3. Now, in second Step use the log file to be sent as an email attachment using T-SQL

    • exec msdb.dbo.sp_send_dbmail @file_attachments = 'Path\Filename.txt'

This should work fine. I am not aware of any inbuilt solution for this.