Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to:
SQL Server
Returns metadata about a specific SQL Server Agent job step log. sp_help_jobsteplog
doesn't return the actual log.
Transact-SQL syntax conventions
sp_help_jobsteplog
[ [ @job_id = ] 'job_id' ]
[ , [ @job_name = ] N'job_name' ]
[ , [ @step_id = ] step_id ]
[ , [ @step_name = ] N'step_name' ]
[ ; ]
The job identification number for which to return job step log information. @job_id is uniqueidentifier, with a default of NULL
.
Either @job_id or @job_name must be specified, but both can't be specified.
The name of the job. @job_name is sysname, with a default of NULL
.
Either @job_id or @job_name must be specified, but both can't be specified.
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
.
The name of the step in the job. @step_name is sysname, with a default of NULL
.
0
(success) or 1
(failure).
Column name | Data type | Description |
---|---|---|
job_id |
uniqueidentifier | Unique identifier of the job. |
job_name |
sysname | Name of the job. |
step_id |
int | Identifier for the step within the job. For example, if the step is the first step in the job, its step_id is 1 . |
step_name |
sysname | Name of the step in the job. |
step_uid |
uniqueidentifier | Unique identifier of the step (system generated) in the job. |
date_created |
datetime | Date that the step was created. |
date_modified |
datetime | Date that the step was last modified. |
log_size |
float | Size of the job step log, in megabytes (MB). |
log |
nvarchar(max) | Job step log output. |
sp_help_jobsteplog
is in the msdb
database.
You can grant EXECUTE
permissions on this procedure, but these permissions might be overridden during a SQL Server upgrade.
Other users must be granted one of the following SQL Server Agent fixed database roles in the msdb
database:
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.
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
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
Events
Apr 8, 3 PM - May 28, 7 AM
Sharpen your AI skills and enter the sweepstakes to win a free Certification exam
Register now!