sp_helphistory SQL Executive Stored Procedure

For SQL Server 6.5 information, see sp_helphistory in What's New for SQL Server 6.5.

Reports the history of one or more scheduled events, alerts, or tasks.

Syntax

sp_helphistory [taskname] [taskid] [eventid] [messageid] [severity] [source] [category] [startdate] [enddate] [starttime] [endtime] [skipped] [, oldestfirst] [mode]

where

taskname
Specifies the name of the task about which a history will be displayed.
taskid
Specifies the ID of the task about which a history will be displayed.
eventid
Specifies the ID of the event from the Windows NT application event log.
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
Specifies the source of the event. Currently, there is only one source, MSSQLServer.
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 were not running).
oldestfirst
Display the oldest task history first.
mode
Specifies the return mode. Can be full (returns all information) or quick (returns only the most useful information). The default is quick.

Remarks

The outcome of the sp_helphistory SQL Executive stored procedure is determined by a match on all specified parameters.

Example

This example displays history of the sysmessages message 55001.

sp_helphistory @messageid = 55001

Permission

Execute permission defaults to the public group.

Tables Used

syshistory, sysoperators, systasks

See Also

sp_addtask sp_purgehistory