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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a SQL Server Job from Windows Job Scheduler

Status
Not open for further replies.

DanAuber

IS-IT--Management
Apr 28, 2000
255
FR
Am I able to write a batch file to run a SQL Server job ?
If so does anyone know where I can find a guide to the syntax ?

thanks for any help

Dan Auber
 
If you go to a command prompt and type
Code:
osql ?
, you'll see the options/syntax needed to run sql commands from a command line (if isqlw.exe is available, you can use it as well).

Here's a sample of what it looks like:
Code:
 osql -S SERVER -d dbName -U userName -P Password -Q "exec sp_MyJob"

-dave
 
Is there any reason why you want to do this from Windows rather than simply scheduling the job directly from SQL Server?

--James
 
Thanks dave

James - because I already have ten jobs in windows scheduler doing other things (not SQL Server related) and I want somewhere where I can manage them all at once....

Dan Auber
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top