Export (0) Print
Expand All
Expand Minimize

sp_purge_jobhistory

SQL Server 2000

Removes the history records for a job.

Syntax

sp_purge_jobhistory [ @job_name = ] 'job_name' | [ @job_id = ] job_id

Arguments

[@job_name =] 'job_name'

Is the name of the job for which to delete the history records. job_name is sysname, with a default of NULL. Either job_id or job_name must be specified, but both cannot be specified.

[@job_id =] job_id

Is the job identification number of the job for the records to be deleted. job_id is uniqueidentifier, with a default of NULL. Either job_id or job_name must be specified, but both cannot be specified.

Return Code Values

0 (success) or 1 (failure)

Result Sets

None

Permissions

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.

Examples
A. Remove history for a specific job

This example removes the history for a job named Table Archives.

USE msdb
EXEC sp_purge_jobhistory @job_name = 'Table Archives'
B. Remove history for all jobs

This example executes the procedure with no parameters to remove all history records.

USE msdb
EXEC sp_purge_jobhistory

See Also

sp_help_job

sp_help_jobhistory

System Stored Procedures

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft