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