Run query every time a SQL Server Agent job runs -
i have around 100 sql server agent jobs run on schedules. need way execute query , dump results every time 1 of jobs runs table.
[job name], [success/fail], [time] etc.
the table custom table can flexible it. google has turned answers in wrong directions.
why not check log file sql server agent?
view sql server agent error log
you can manually query dbo.sysjobhistory
and/or dbo.sysjobactivity
:
dbo.sysjobhistory
contains information execution of scheduled jobs sql server agent. table stored in msdb database.
dbo.sysjobactivity
records current sql server agent job activity , status.
select * msdb.dbo.sysjobhistory
and
select * msdb.dbo.sysjobactivity
Comments
Post a Comment