Categories
Sql Server

How to run Sql server agent job from a Batch file

In this tutorial you will learn how to run a sql server agent job from a batch file.For this you don’t need to know any coding.

  1. Create a job in Sql server to take backup of any database.
  2. Give it name whatever you want and save the job.
  3. Save the below query as batch file.
  4. Run it and you get your result.

Query To Run:-

SQLCMD -Q "EXEC msdb.dbo.sp_start_job @job_name='job name'"