Tuesday, July 17, 2018

How to schedule a job in Microsoft SQL Server

Microsoft SQL Server Management Studio, which is an integrated environment to manage a SQL Server infrastructure, provides us the feature to schedule a job in SQL. We can achieve the scheduling task through SQL Server Agent.

Let’s see how we can achieve our task through SQL Server Agent.

First, open your SQL Server Management Studio. As you open you will find the following screen.


Here you can see the Object Explorer tab which includes your Server Name. Expand it and you will find the various options (also called objects) in it like Database, Security, Server Objects, Replication, etc. The last option is SQL Server Agent and this is where we need to do our scheduling.


Click on the + sign in front of SQL Server Agent to expand it. See the above image. Right click on Jobs and then on New Job…  . A new window will appear as shown below.
SQL Server Agent - Jobs - New Job… 


Fill the General details like Name and Description.

Select Steps on left hand side of the window and then click New which is at the bottom.


The Steps window will open, enter the Step name. Next, in type, select Transact-SQL script (T-SQL), choose the database against which the query will run and write the query in the space provided for command.



Select on the schedules option on the left side of the window and click on New.


A new window will appear where we have to set the name, Frequency, time and Start date as per which the job will run.


Once set, click on OK and our scheduling process is completed. Now the schedule will run as per the date and time mentioned.

You can also see your job status from Job Activity Monitor

About Author
Kumar Ankit is a BI Consultant at Prudence Technology. He is B. Tech from Chandigarh Engineering College and has started his career with Prudence Technology. He own a technical blog as well named techanswersweb.wordpress.com (https://techanswersweb.wordpress.com/).
 He can also be reached at: [email protected]



1 comment: