Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Starting a job through a bat file

Status
Not open for further replies.

jymm

Programmer
Apr 11, 2002
707
US
I have a job that has quite a few DTS steps & transact-sql steps.

This job runs on a scheduled basis.

Now I also want to run the whole job from a .bat file and either it is late in the day & BOL is hiding what I want, or I need more caffine.

Is there a way to run a job from a .bat file (and will the .bat execution wait 'till the whole job is done) or do I need to run each dts as seperate line in the .bat file?

Thanks in advance for your help - j
 
You can use osql and sp_start_job to start the job but it won't wait for completion of the job.

======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Take a look in BOL @ sp_start_job.
The syntax is :

EXEC sp_start_job @job_name = 'Nightly Backup'

I use this from a batch job that runs an OSQL statement. The batch file runs various other tasks then fires off the saved job.
 
I'm pretty sure there's an option to run DTS from the command line, dtsrun or something, but I do like using Sql Server Agent much better...In fact, can't you schedule directly from Enterprise Manager? I think you can even notify via email if the DTS fails...
 
Thanks much folks

I already run a fair number of DTS through jobs and also through command lines. This application requires me to run a set of DTS & t-sql (that is already defined as a job) and then run a few additional sql scripts through OSQL --- followed by a few Crystal financial monitoring reports

Thanks for the direction into BOL - sometimes just finding what I want is the struggle for me since terms are different than what I would expect

You folks are the best!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top