Executing a DTS package from a stored Procedure

Hi All

How can I execute a DTS package stored on my SQL Server from a stored procedure.

Many Thanks

demmickAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
iamariConnect With a Mentor Commented:
in the stored proc is like:

exec master..xp_cmdshell 'DTSRun /S (local) /U sa /P  /N myPackageName', NO_OUTPUT

where User id (sa) and Password (if existing) should be provided
no_output prevents the server from sending back the "Loading... " message to user
0
 
nigelrivettCommented:
look at dts_run and xp_cmdshell.
Or you could set the job to run under the scheduler then use sp_startjob.
0
 
nigelrivettCommented:
oops dtsrun
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
demmickAuthor Commented:
I know of the dtsrun comand but I can't use it in the Query analyser.  I am assuming that it will work in the stored procedure if it works in the query analyser.
0
 
niklausjCommented:
you can't use dtsrun directly from qa or sp, since it's a DOS command, you need to run it via xp_cmdshell (blocking) or add a job and use sp_startjob in your sp.
0
 
chigrikCommented:
Read about "How can I run a DTS package from within SQL Server - e.g. a stored-procedure?"
http://www.ntfaq.com/Articles/Index.cfm?ArticleID=14230

Hope this helps
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.