SQL_EXECUTE_JOB

The SQL_EXECUTE_JOB script element executes a job on the MS SQL Server. To start the MS SQL jobs, the agent uses the sp_start_job stored procedure in the msdb database.

Important!

  • The AE job aborts if the user is not authorized, or if a database other than Microsoft SQL Server is used.

  • If you terminate the AE job while the MS SQL job is still active, the agent calls the sp_stop_job stored procedure. Therefore, the MS SQL job does not abort immediately, but is monitored until it has officially ended.

Tip: You can write a script to retrieve a list of all available MS SQL jobs. For more information, see SQL_GET_JOBS.

Syntax

SQL_EXECUTE_JOB

JOB=...

Parameters

  • SQL_EXECUTE_JOB
    Executes a job on the MS SQL Server

  • JOB=
    Name of the MS SQL job

The status of the AE job depends how the started MS SQL job was processed:

  • ENDED_OK
    MS SQL job has successfully ended

  • ENDED_NOT_OK
    MS SQL job has aborted

  • ENDED_CANCEL
    The user has canceled the MS SQL job

Examples

SQL_EXECUTE_JOB JOB="Integrity Checks Job for DB Maintenance Plan";

See also: