Removes the history records for a job.
sp_purge_jobhistory [@job_name =] 'job_name' | [@job_id =] job_id
0 (success) or 1 (failure)
None
Execute permissions default to the public role. If no parameters are supplied, all history records are removed; however, only members of the sysadmin fixed server role have permission to do this.
This example removes the history for a job named Table Archives.
USE msdb
EXEC sp_purge_jobhistory @job_name = 'Table Archives'
This example executes the procedure with no parameters to remove all history records.
USE msdb
EXEC sp_purge_jobhistory
sp_help_job | System Stored Procedures |
sp_help_jobhistory |