Scheduled execution of SQL statements using task plans

Source: Internet
Author: User

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

Use ttnew // use the ttnew Database
Go
Insert into users (name) values ("") // insert a record to users
Save the statement in the user. SQL file and put it in the drive D and directory.

2. Write a batch file, for example:

Create another notepad, write the statement osql-E-I d: \ User. SQL in it, and save it as 11.bat.

3. Use the system task plan to call batch files and execute SQL statements

In the systemProgram-> Accessories-> System Tools-> Task Plan
Add a new task scheduler, click Next, browse, find the 11. BAT file, select the execution time, and click Next. Keep clicking. Enter the password of the Local Machine and click Finish.

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.