How to schedule a job in SQL Server? It’s an easy question to answer. In this article, I will drive through one of the most common tasks that a DWH developer may need to perform.
What’s a SQL Job?
A job in SQL Server is a sequence of actions that will be performed sequentially after the job is started. These actions are also called “steps”. A step in a job can be identified as an SSIS package or T-SQL scripts. In the case we want to set up a job to run a stored procedure, we basically are going to execute a T-SQL scripts of type “exec [name of the stored procedure]”
Scheduling a job is a process that needs to put into account different factors. When you schedule a job to run automatically, you’re actually saying to the database engine to perform those steps at a certain point in time.
How to schedule a job in Sql Server?
First thing you need to schedule a job in SQL is to open your SQL Management Studio.
Here under SQL Server Agent you will find a folder named “Jobs”. Find the job you want to schedule and then double click on it.
A new window will open “Job Properties”
In the left pane you can navigate the different tabs. Please click on “Schedules”. In the “Schedules” tab you can find all the schedules that have been created for the current job. You can edit an exsting schedule by clicking on the “Edit” button below.
If you want to create a new schedule you just need to click on the “New..” button. A new window will pop up (“New Job Schedule”).
Here you can decide the time of the schedule and the type. The type of the schedule means if the job needs to be recurring, to run once or to run when a certain event triggers it.