Solved

Executing a DTS package from a stored Procedure

Posted on 2001-06-04
6
405 Views
Last Modified: 2013-11-30
Hi All

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

Many Thanks

0
Comment
Question by:demmick
6 Comments
 
LVL 18

Expert Comment

by:nigelrivett
Comment Utility
look at dts_run and xp_cmdshell.
Or you could set the job to run under the scheduler then use sp_startjob.
0
 
LVL 18

Expert Comment

by:nigelrivett
Comment Utility
oops dtsrun
0
 

Author Comment

by:demmick
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Expert Comment

by:niklausj
Comment Utility
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
 
LVL 8

Expert Comment

by:chigrik
Comment Utility
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
 
LVL 2

Accepted Solution

by:
iamari earned 15 total points
Comment Utility
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

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now