HELP... start a job from code or a stored procedure - 09-12-2005 , 09:49 AM
I would like to know if it is possible to start a job from a stored
I have a DTS that I set as a job and would like to either call it from
an ADP with
Conn.Execute "EXEC msdb..sp_start_job @job_name = 'Volusia'"
OR just strat it with a stored procedure and call the stored procedure
from the adp
CREATE PROCEDURE sde.Volusia_Import AS
EXEC msdb..sp_start_job @job_name = 'Volusia_Import'
I tried both of these and it does not give me an error but it does not
run the job... what am I missing?
Re: HELP... start a job from code or a stored procedure - 09-12-2005 , 02:39 PM
You can run DTS packages with the OLE Automation objects or with
xp_cmdshell to run dtsrun.exe. You can find out about dtsrun in Books
Online, and an example using the OLE Automation objects appears below.
I'm copying this example from
DECLARE @object int
DECLARE @hr int
--create a package object
EXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUT
if @hr <> 0
print 'error create DTS.Package'
EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile',
NULL, 'C:\NewPack.dts', ''
IF @hr <> 0
print 'error LoadFromStorageFile'
EXEC @hr = sp_OAMethod @object, 'Execute'
IF @hr <> 0
print 'Execute failed'
"meyvn77 (AT) yahoo (DOT) com" <meyvn77 (AT) yahoo (DOT) com> wrote