I have a sql agent job step that failed for a given date / time. Is there an MSDB – TSQL query I can run to view the step failure reason given that :
- I know the job name.
- I know when the job failed.
- I know the step number
sql serversql server 2014
I have a sql agent job step that failed for a given date / time. Is there an MSDB – TSQL query I can run to view the step failure reason given that :
Best Answer
You can get failure reason by looking at message section of SQL-Agent Job history window.
If the error produce more than 1024 characters, you can query
msdb.dbo.sysjobhistory
, to be specific to the requirement, you can use following query: