TechNet
Export (0) Print
Expand All
Collapse the table of content
Expand the table of content
Expand Minimize

sp_help_jobsteplog (Transact-SQL)

 

Updated: August 9, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Returns metadata about a specific SQL Server Agent job step log. sp_help_jobsteplog does not return the actual log.

Topic link icon Transact-SQL Syntax Conventions

  
sp_help_jobsteplog { [ @job_id = ] 'job_id' | [ @job_name = ] 'job_name' }  
     [ , [ @step_id = ] step_id ]  
     [ , [ @step_name = ] 'step_name' ]  

[ @job_id =] 'job_id'
The job identification number for which to return job step log information. job_id is int, with a default of NULL.

[ @job_name =] 'job_name'
The name of the job. job_name is sysname, with a default NULL.

System_CAPS_ICON_note.jpg Note


Either job_id or job_name must be specified, but both cannot be specified.

[ @step_id =] step_id
The identification number of the step in the job. If not included, all steps in the job are included. step_id is int, with a default of NULL.

[ @step_name =] 'step_name'
The name of the step in the job. step_name is sysname, with a default of NULL.

0 (success) or 1 (failure)

Column nameData typeDescription
job_iduniqueidentifierUnique identifier of the job.
job_namesysnameName of the job.
step_idintIdentifier for the step within the job. For example, if the step is the first step in the job, its step_id is 1.
step_namesysnameName of the step in the job.
step_uiduniqueidentifierUnique identifier of the step (system generated) in the job.
date_createddatetimeDate that the step was created.
date_modifieddatetimeDate that the step was last modified.
log_sizefloatSize of the job step log in megabytes (MB).
lognvarchar(max)Job step log output.

sp_help_jobsteplog is in the msdb database.

By default, members of the sysadmin fixed server role can execute this stored procedure. Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb database:

  • SQLAgentUserRole

  • SQLAgentReaderRole

  • SQLAgentOperatorRole

For details about the permissions of these roles, see SQL Server Agent Fixed Database Roles.

Members of SQLAgentUserRole can only view job step log metadata for job steps that they own.

A. Returns job step log information for all steps in a specific job

The following example returns all the job step log information for the job named Weekly Sales Data Backup.

USE msdb ;  
GO  
  
EXEC dbo.sp_help_jobsteplog  
    @job_name = N'Weekly Sales Data Backup' ;  
GO  

B. Return job step log information about a specific job step

The following example returns job step log information about the first job step for the job named Weekly Sales Data Backup.

USE msdb ;  
GO  
  
EXEC dbo.sp_help_jobsteplog  
    @job_name = N'Weekly Sales Data Backup',  
    @step_id = 1 ;  
GO  

sp_add_jobstep (Transact-SQL)
sp_delete_jobstep (Transact-SQL)
sp_help_jobstep (Transact-SQL)
sp_delete_jobstep (Transact-SQL)
sp_delete_jobsteplog (Transact-SQL)
SQL Server Agent Stored Procedures (Transact-SQL)

Community Additions

ADD
Show:
© 2016 Microsoft