To set a timer task by using SQL Server 2005 jobs

Source: Internet
Author: User

Original: Set up Scheduled Tasks using SQL Server 2005 jobs

The company has an old project because directly to the terminal shot pictures in the form of binary saved to the database, the database is larger so need to often delete these redundant data, manual removal time and effort, project leader let me turn these operations into automatic, do once a day, only the last two months of image data. Consulted the relevant information, found a solution, here to make a record, so that people with the same needs and their own access.

Now we're going to show you how to set up a timed task with a very simple example: we have an employee table and we add a piece of data to it on a regular basis. An example of how to use the job task of SQL Server to periodically delete data is to learn how to do this:

Table structure:

1. Turn on the SQL Server Agent service

Using a job requires support for the SQL Agent service and needs to be set to start automatically, otherwise your job will not be executed.

The following steps open the service: Start-->>> run-->>> enter "Services.msc"-->>> enter the service, turn on the SQL Server Agent service, and set to Automatic.

:

  

2. New Job

Click "SQL Server Agent", "right click Job", select "New Job"

3. Set the name and description of the new job

4. Set up a task's execution steps

Select the "Step" option and click "New" to add the first step: Insert the data and click "OK".

We can also go on to create new steps and do more in the Advanced options in the dialog box of the new step. ()

5. Set up the execution plan

Select schedule options, new schedule

Configure the direct schedule as needed:

Click OK to make sure our plan is complete: the statement that inserts the data starts on March 8, 2012, executes hourly, and in the new Job dialog we have the option not set, but this is not necessary, you can do the relevant settings according to the specific situation.

Original address: http://www.cnblogs.com/IPrograming/archive/2012/03/08/SQLServer_Timer.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.