Skip to main content

import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

SQL job actions

What is it?

This page lists the job types supported by the SQL Agent and shows reference examples for each one. Use it to:

  • Confirm which job action fits the database platform you target.
  • Compare configuration options for a single job type at a glance.
  • Find a worked example to base a new job on.

For the full field-by-field reference, see SQL Job Details in the Concepts online help.

Job action quick reference

Job actionUse it forField reference
MS SQL DTExecRunning SSIS packages with dtexecFields for MS SQL DTExec
MS SQL JobTriggering SQL Server Agent jobsFields for MS SQL Job
MS SQL ScriptRunning ad-hoc T-SQL or script filesFields for MS SQL Script
MySQLRunning queries or scripts against MySQLFields for MySQL
OracleRunning queries or scripts against OracleFields for Oracle
Other DBODBC or OLE DB connections to any other databaseFields for Other DB
How to use this page

Each job-type section uses tabs to switch between configuration variants. Pick the tab that matches your scenario rather than scrolling through every variant.


MS SQL DTExec

Run SQL Server Integration Services (SSIS) packages through dtexec. Choose the connection type tab that matches how your packages are stored — file system or SQL Server.

For the field reference, see Fields for MS SQL DTExec in the Concepts online help.

Use FILE when the SSIS package is stored on the file system.

Defining MS SQL DTExec with FILE Connection

Use SQL when the SSIS package is stored in MS SQL Server.

Defining MS SQL DTExec with SQL Connection


MS SQL Job

Start a SQL Server Agent job and control how the SQL Agent monitors it. Each tab shows a different monitoring strategy or option.

For the field reference, see Fields for MS SQL Job in the Concepts online help.

The SQL Agent reports the job's final status when it finishes.

Defining MS SQL Job to Monitor until Completion

The SQL Agent monitors the job only while the SQL Server Agent job is running.

Defining MS SQL Job to Monitor while Job Runs

The SQL Agent monitors the job until the run time you specify.

Defining MS SQL Job to Monitor with Specified End Time

Start and monitor a job, overriding the saved credentials with a password supplied at runtime.

Defining MS SQL Job to Monitor with Password Overwrite Option


MS SQL Script

Run T-SQL against MS SQL Server. The script can be written in line in the job definition or pulled from a .sql file. Pick the tab that matches how you want the script and any runtime values supplied.

For the field reference, see Fields for MS SQL Script in the Concepts online help.

The script is written directly in the job definition.

Defining MS SQL Script with In Line Script

The job passes environment variables into the script at runtime.

Defining MS SQL Script with Environment Variables

Combines an in-line script with environment variables.

Defining MS SQL Script with In Line Script and Environment Variables

Specifies an output file path and applies a password overwrite at runtime.

Defining MS SQL Script with Output File Path and Password Overwrite Option

Authenticates with the agent's Windows account and runs a script from a .sql file.

Defining MS SQL Script with Windows Authentication and Script File


MySQL

Run queries or scripts against MySQL. The example tabs show the most common configurations.

For the field reference, see Fields for MySQL in the Concepts online help.

Connects to MySQL on the default port.

Defining MySQL with Default Port

Overrides the saved password at runtime.

Defining MySQL with Password Overwrite Option

Runs a script file and substitutes environment variables into the SQL.

Script File Path: C:\SQLScripts\mysql_insert_params.sql

Mysql_insert_params.sql script details:

Insert into address (Lastname, Firstname, Address) values (@LN, @FN, @ADS);

Defining MySQL with Environment Variables


Oracle

Run jobs against Oracle. The tabs cover the most common parameter and connection patterns.

For the field reference, see Fields for Oracle in the Concepts online help.

Writes job output to a specified file path and applies a password overwrite.

Defining Oracle with Output File Path and Password Overwrite Option

Passes parameters into the Oracle job at runtime.

Defining Oracle with Parameters

Passes encrypted parameters into the Oracle job.

Defining Oracle with Encrypted Parameters

References a saved Oracle connection by ID rather than entering the connection details inline.

Defining Oracle with Connection ID


Other DB

Connect to any database through ODBC or OLE DB. Use this job action when the database isn't covered by one of the dedicated job types above. The three sub-sections below correspond to the three connection methods.

For the field reference, see Fields for Other DB in the Concepts online help.

DSN Name connections

Connect through a Data Source Name configured on the agent machine.

In Line Script with environment variables — first part.

Defining Other DB using DSN Name with In Line Script and Environment Variables 1

In Line Script with environment variables — second part.

Defining Other DB using DSN Name with In Line Script and Environment Variables 2

DSN Name connection with password overwrite at runtime.

Defining Other DB using DSN Name with Overwrite Password Option

OleDB Connection String

Connect by supplying a full OLE DB connection string in the job definition.

OleDB connection string with an in-line script.

Defining Other DB using OleDB Connection String with In Line Script

OleDB connection string with a .sql script file. The script accepts parameters supplied at runtime.

Insert-with-params.sql script file details:

declare @LN varchar(25), @FN varchar(25), @Ads varchar(50), @zip int;

set @LN = $(LN);

set @FN = $(FN);

set @Ads = $(Ads);

set @zip = $(zip);

select * from address where Lastname = @LN;

insert into address values(@LN,@FN,@Ads,@zip);

Defining Other DB using OleDB Connection String with Script File

OleDB connection string with environment variables.

Defining Other DB using OleDB Connection String with Environment Variables

ODBC Connection String

Connect by supplying a full ODBC connection string in the job definition.

ODBC connection string with an in-line script.

Defining Other DB using ODBC Connection String with In Line Script

ODBC connection string with an in-line script and environment variables.

Defining Other DB using ODBC Connection String with In Line Script and Environment Variables