Use SQL to identify log file for failed instance of SQL job

  • I need SQL code to identify the text log file associated with a specific instance of a failed job.  I have code that I use as the last step in a job that gets the SQL Server error information that is available, in place of the default failure email, but can't figure out how to identify and attach a specific task log file from the log directory.

  • How is the text log file being created?  If it's from the Advanced section of the job step, you could simply check "Log to table" as well.  In your final step, query off of sysjobstepslogs and grab the info from the log field.  Include it in your email.

    Regards,
    Rubes

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply