I want to execute a stored procedure automatically at every night. How can I do it. Please guide me with steps to achieve this target.
Thanks in advance.
In Object Explorer, connect to an instance of the SQL Server Database Engine, expand that instance, and then expand Databases. Expand the database that you want, expand Programmability, and then expand Stored Procedures. Right-click the user-defined stored procedure that you want and select Execute Stored Procedure.
You can use the administrative task scheduler to execute stored procedures at a specific time. You must first define a task for the stored procedure execution. Then, when the specified time or event occurs for the stored procedure to run, the administrative task scheduler calls the stored procedure.
In the 'Steps' window enter a step name and select the database you want the query to run against. Paste in the T-SQL command you want to run into the Command window and click 'OK' . Click on the 'Schedule' menu on the left of the New Job window and enter the schedule information (e.g. daily and a time).
You can create a job with the SQL Server Agent.
Right-click on the Jobs folder to open the menu, select New Job:
When you create a new job a window will open and you will provide the details of you job that you want to create. Including:
Here is a Step by Step by Guide to creating a SQL Job
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With