dbo.sysjobsteps (Transact-SQL)

Applies to: SQL Server

Contains the information for each step in a job to be executed by SQL Server Agent. This table is stored in the msdb database.

Column name Data type Description
job_id uniqueidentifier ID of the job.
step_id int ID of the step in the job.
step_name sysname Name of the job step.
subsystem nvarchar(40) Name of the subsystem used by SQL Server Agent to execute the job step.
command nvarchar(max) Command to be executed by subsystem.
flags int Reserved.
additional_parameters ntext Reserved.
cmdexec_success_code int Error-level value returned by CmdExec subsystem steps to indicate success.
on_success_action tinyint Action to be performed when a step is executed successfully.

1 = (default) Quit with success

2 = Quit with failure

3 = Go to next step

4 = Go to step on_success_step_id
on_success_step_id int ID of the next step to execute when a step is executed successfully.
on_fail_action tinyint Action to be performed when a step is not executed successfully.

1 = Quit with success

2 = (default) Quit with failure

3 = Go to next step

4 = Go to step on_fail_step_id
on_fail_step_id int ID of the next step to execute when a step is not executed successfully.
server sysname Reserved.
database_name sysname Name of the database in which command is executed if subsystem is TSQL.
database_user_name sysname Name of the database user whose account will be used when executing the step.
retry_attempts int Number of retry attempts made if the step fails.
retry_interval int Amount of time to wait between retry attempts.
os_run_priority int Reserved.
output_file_name nvarchar(200) Name of the file in which the step's output is saved when subsystem is TSQL, PowerShell, or CmdExec.
last_run_outcome int Outcome of the previous execution of the job step.

0 = Failed

1 = Succeeded

2 = Retry

3 = Canceled

5 = Unknown
last_run_duration int Duration (hhmmss) of the step the last time it ran.
last_run_retries int Number of retry attempts in the last execution of the job step.
last_run_date int Date (yyyymmdd) the step last started execution.
last_run_time int Time (hhmmss) the step last started execution.
proxy_id int Proxy for the job step.
step_uid uniqueidentifier Identifier for the job step.

See Also

SQL Server Agent Tables (Transact-SQL)