Use batch processing to establish Windows tasks, execute SQL Server stored procedures, or SQL statements

Source: Internet
Author: User

The same functionality can be achieved with SQL Server Agent-based tasks. However, in practice, the SQL Server Agent service is always unable to start, because it is not the home server, so find another way.

The batch code is as follows:

1 - 127.0. 0.1 - - - -I F:\pro.sql

Copy the above code into a text document, save and change the extension to a. bat file.

For osql parameters, you can execute the following statements directly under CMD

The Pro.sql file writes the stored procedure or SQL statement that needs to be executed, as follows:

exec stored procedure name;

Set up Windows tasks

Creating tasks, starting with Task Scheduler, management tools

New Trigger

New action

After the above steps are completed, you can check the task click Start to test

Use batch processing to establish Windows tasks, execute SQL Server stored procedures, or SQL statements

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.