I am using SQL Server 2008 and I need to run a SQL Job from SQL Server Agent. I am new to SQL Server Job and I want to execute a stored procedure regularly from a SQL Server Job. But I did not find where to specify the executed stored procedure other than copy & paste SQL commands.
Here is my screen snapshot:
Any ideas how to assign stored procedure to execute in SQL Server Job?
Expand SQL Server Agent, expand Jobs, right-click the job that you want to schedule, and click Properties. Select the Schedules page, and then click Pick. Select the schedule that you want to attach, and then click OK.
SQL Server Agent is the job scheduling tool for SQL Server. To execute a job on demand using the GUI, open the SQL Server Agent tree, expand Jobs, select the job you want to run, right click on that job and click 'Start Job' and the job will execute.
Now, to automate the execution of a stored procedure, we need to schedule its execution. So, when the specified time has reached the stored procedure will automatically get executed. Now, in SQL Server, we usually use the SQL Server Agent to schedule a job that consists of executing a stored procedure.
You just need to add this line to the window there:
exec (your stored proc name) (and possibly add parameters)
What is your stored proc called, and what parameters does it expect?
As Marc says, you run it exactly like you would from the command line. See Creating SQL Server Agent Jobs on MSDN.
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