MSSQL SSIS – Create Job to run Package solution .dtsx file via T-SQL Command

1. First, enable xp_cmdshell on SQL Management Studio with following commands:

sp_configure 'show advanced options', '1'
RECONFIGURE
-- this enables xp_cmdshell
sp_configure 'xp_cmdshell', '1'
RECONFIGURE


2. Then, Go to SQL Server Agent -> Jobs -> Create/Edit a Job -> Edit Step -> Change to Transcript-SQL script (T-SQL)


3. Use this syntax as in examples below:

Example 1:

EXEC xp_cmdshell 'dtexec /f "C:\Users\Kazar\Documents\Package1.dtsx"

Example 2:

EXEC xp_cmdshell 'dtexec /f ""\"\SSISDB\STG_EMIR_MIFIR\STG_EMIR_MIFIR\STG_EMIR_MIFIR.dtsx"'


4.Run the Job again and make sure you see SUCCESS twice!

 

Enjoy 🙂