Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to execute SQL statements regularly in SQLServer 2000

2025-04-11 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to execute SQL statements regularly in SQLServer 2000". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "SQLServer 2000 how to execute SQL statements regularly"!

I don't know if stored procedures can be implemented, but the job scheduling of SQL Server 2000 does have such a function. How to make some SQL statements execute regularly? Do the following in turn: enterprise Manager-Administration-SQL Server Agent-right Job-New Job-- enter Job name in "General" item-- New step item-- enter step name in "step name"-- Select "Transact-SQL script (TSQL)" in "Type"-- number of commands selected by "Database" According to the library-- enter the statement to be executed in the "Command": INSERT / DELETE...-- OK-- "schedule" item-- New schedule-- enter the schedule name in "name"-- Select your job execution schedule in "scheduling Type"-- if you select "repeat"-- click "change" to set your schedule (we can see The highest frequency is to set the occurrence period to 1 minute in the "Daily Frequency", that is to say, the real-time performance of 1 minute can be guaranteed by this method, for applications with low real-time requirements. This is enough) finally, start the SQL Agent service and set it to start automatically, otherwise your job will not be set to automatically start the SQL Agent service: my computer-- Control Panel-- Administrative tools-- Services-- right-click the SQLSERVERAGENT-- property-- Startup Type-- Select "Auto start"-- OK. After setting up, you can see the new job name in "Job" in Enterprise Manager. If the "enabled" status of the job is "No", click "right"-"start Job" on that line of the job.

The second method: let's introduce how to achieve it through bat, the above configuration is really tedious.

1. Prepare the SQL statements to be executed, such as:

Use ttNew / / insert a record into the table Users using the ttNew database Goinsert into Users (name) values ("") / / and save the statement in the file user.sql, under the d disk and directory.

two。 Write a batch file, for example:

Create a new notepad, write the sentence osql-E-I d:\ user.sql in it, and save it as 11.bat

3. Use the system task plan to call the batch file and execute the SQL statement

Add a new task schedule in system programs-> Accessories-> system tools-> Task Plan, click next, click Browse, find the 11.bat file, select the execution time, and click next. Click all the time, and finally enter the password of the machine, click to complete.

At this point, I believe you have a deeper understanding of "SQLServer 2000 how to execute SQL statements regularly". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 296

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report