How to Run SQL Server Agent jobs in Batch File - SQL Server DBA Tutorial

In this video you will learn how to run SQL Server Agent Job in a Batch file, it explains step by step process of creating a batch file using SQLCMD, connecting with target SQL Server, database and running SQL Server Store procedure from a batch file. It also shows step by step process of creating and scheduling batch job in windows scheduler instead of using SQL Server Agent Scheduler.

Script used in video to Run SQL Server Agent Job from Batch File

sqlcmd -S TBSSQL\SQLPROD -E -d MSDB -Q "sp_start_job 'Test'"



How to Execute SQL Server Agent Job/s From Batch File - SQL Server DBA Tutorial

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.