sp_purgehistory SQL Executive Stored Procedure
Removes information from the history log.
Syntax
sp_purgehistory [taskname] [, taskid] [, eventid] [, messageid] [, severity] [, source] [, category] [, startdate] [, enddate] [, starttime] [, endtime] [, skipped]
where
-
taskname
-
Specifies the name of the task about which a history will be displayed. You must be the task owner, unless you are the system administrator.
-
taskid
-
Specifies the ID of the task about which a history will be displayed. You must be the task owner, unless you are the system administrator.
-
eventid
-
Reserved.
-
messageid
-
Specifies the ID of the message as stored in the sysmessages table.
-
severity
-
Specifies the severity of the message as stored in the sysmessages table or passed with the RAISERROR statement.
-
source
-
Reserved.
-
category
-
Reserved for future use.
-
startdate
-
Specifies tasks beginning their scheduled run(s) on this date.
-
enddate
-
Specifies tasks ending their scheduled run(s) on this date.
-
starttime
-
Specifies tasks beginning their scheduled run(s) at this time.
-
endtime
-
Specifies tasks ending their scheduled run(s) at this time.
-
skipped
-
Specifies the number of times this task's run was skipped (usually because the server or SQL Executive was not running).
Remarks
The sp_purgehistory SQL Executive stored procedure clears all records found by matching all specified parameters.
Example
This example clears the history for taskid 12.
sp_purgehistory @taskid = 12
Permission
Execute permission defaults to the public group.
Tables Used
syshistory, systasks
See Also