Sql-server – History from SQL Agent Jobs (SQL Server 2005)

sql serversql-server-2005

  • how can I able to see all available records from SQL Agent Jobs, because in SSMS is dispayed only reduced number of records
  • are these records stored in system databases, not only in plain log files
  • how can I get records generated by SQL Agent Jobs only
  • is this history settable,

enter image description hereenter image description here

Best Answer

You need msdb.dbo.sysjobhistory and a few JOINs of course to read the data

To change how SQL Server Agent uses this table, use this stored procedure with suitable values

EXEC msdb.dbo.sp_set_sqlagent_properties
    @jobhistory_max_rows = 1000,
    @jobhistory_max_rows_per_job = 100