Here in this example I will show you how to execute a task or call a store procedure at a specific time(like at midnight) using SQL Server or I can say how to schedule a job at a specific time. Some times you have to perform some thing daily, weekly or at a specific gap of time. Repeat the same task every time by a person is little bit difficult. So in that case SQL is here to solve your problem using SQL Job Scheduler. This is a task you fixed in your server, set timer on at particular time and write down the SQL query to perform. That's all you have to do. Lets see how to schedule your Job at a specific time.
Open your Management Studio and check the SQL Server Agent. Start the SQL Server Agent by following steps.
Open your Management Studio and check the SQL Server Agent. Start the SQL Server Agent by following steps.
Now go to Job section in your SQL Server Agent and click to New Job.
After selecting the New Job a new window will be opened with all the properties of a New Job. Now fill up each and every field according to your specification.
In the General tabs write down any name according to your project and left the others as it is.
In the Step tab click on the New button, and a new window will be opened.
Write a name for your step and your query to be executed and click on the OK button.
In the Schedule tab follow the steps as the image bellow.
Now your job is almost done. The only thing is left to start your job. To start the job follow the step.
After successfully starting of the job you will get a successful alert message.
So, your job schedule is done. Enjoy with your new job schedule. :)
0 comments:
Post a Comment