SQL Server 2000 timed execution _mssql

Source: Internet
Author: User

I don't know if the stored procedure can be implemented, but the job scheduler for SQL Server 2000 does have the ability to make certain SQL statements run at regular intervals, and then do the following:

Enterprise Manager
--Management
--sql Server Agent
--Right key job
--New job
--Enter the job name in the general item
--"Step" item
--New
--Enter the step name in step name
--in type, select Transact-SQL script (TSQL)
--"Database" Select Database to execute command
--in command, enter the statement you want to execute:
Insert/delete ...
-Determine
--"Schedule" item
--New schedule
---Enter the schedule name in the name
---"Schedule Type" Select your job execution schedule
--If you choose to "recur"
--click "Change" to set your schedule
(we can see that the highest frequency is in the "daily frequency" will occur in the period of 1 minutes , that is, this method can guarantee 1 minutes of real-time, for real-time requirements of the application is not high, this is enough)
Finally, start the SQL Agent service and set it to start automatically, or your job will not be installed. To set the SQL Agent service to start automatically: My Computer--control Panel--management tools--services--right--sqlserveragent--Properties--Startup Type--select " Auto Start "--OK.
After setting up, you can see the new job name in job in Enterprise Manager, and if the job's enabled state is no, right-start job on the line of the job.

The second method: let's introduce how to do this through bat, the configuration is really cumbersome.

1. Prepare the SQL statements to be executed, for example:

Use Ttnew//using Ttnew Database
Go
Insert into users (name) VALUES ("")//Insert a record to table users
Save the statement in the file User.sql, and place it in the D-disk directory.

2. Write a batch file, such as:

And then create a new Notepad, inside the statement osql-e-I d:\user.sql, save as 11.bat

3. Call batch file with System task plan, execute SQL statement


-> attachment-> System Tools-> Task Scheduler in System program
Add a new task schedule, click Next, click to browse, find 11.bat files, select execution time, click Next. Always point, and finally enter the password of this machine, point complete.

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.