How to execute SSIS package (aka DTXS file) from SQL.

I have created and SSIS package that I am trying to execute in a SQL query.  Below is the command I am trying to run:

EXEC master.dbo.sp_configure 'show advanced options', 1
EXEC master.dbo.sp_configure 'xp_cmdshell', 1
execute xp_cmdshell 'DTEXEC.EXE /F "d:\Package1.dtsx"'

Open in new window

Attached I have a screenshot of the error messages I get.

However, when I execute the following from a Windows Command Line, it works fine:

DTEXEC.EXE /F "d:\Package1.dtsx

Open in new window

I have been doing a lot of research and I can’t figure this out.  Any help would be greatly appreciated.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rye004Author Commented:
Thank you Mr. Admin.  I just updated it, is that better?
Rainer JeschorCommented:
I assume that your package uses the protection configuration setting "Encrypt sensitive with user key". Therefore when you execute the package through a CMD, it uses your credentials and can decrypt the encrypted content.

When you execute it via T-SQL, the process is run with the credentials of the SQL Server service - and that one cannot decrypt the values hence the error message.

You have now three options:
- Change the protection level to "Do not save sensitive" and set the connection options otherwise
- Change the protection level to "Encrypt sensitive with password" and set a password. Then provide the password as additional parameter to the DTExec call : /DECRYPT YOURPASSWORD
- Create credentials and a proxy account in SQL Server to map to your credentials and run the T-SQL as part of an SQL Agent Job where you set the execution context to the created proxy/credentials


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rye004Author Commented:
Your second option worked great!  Many thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.