Fearghal
Fearghal

Reputation: 11407

SQL Server 2008 Trigger Sql Job from bat file

How can i trigger an SQL job from a bat file?

I will need to input my credentials: user and password, the bat file will be sitting on the server and i want folks to execute bat by double click over windows explorer.

Upvotes: 1

Views: 1194

Answers (3)

Fearghal
Fearghal

Reputation: 11407

Got it.

Cheers guys. sqlcmd -Sxxxx -Uxxxx -Pxxxx -dxxxx -Q"exec msdb.dbo.sp_start_job xxxxxx"

Upvotes: 0

user2793797
user2793797

Reputation: 36

CD C:\Program Files\Microsoft SQL Server\100\Tools\Binn

osql -S “[SQL SERVER NAME]” -E -Q”exec msdb.dbo.sp_start_job ‘[SQL JOB NAME]‘”

Upvotes: 1

RGuggisberg
RGuggisberg

Reputation: 4750

SQLCMD is what you need. SQLCMD /?

Upvotes: 1

Related Questions