I'm using the sp_start_job system stored procedure to run a job on the SQL Server Agent. The sp_start_job stored procedure takes a parameter called, step_name where you can begin execution from that step. My problem is that I only want to run that one step of the job rather than that step and every step after it. Is there a way to only execute one particular step Or a safe way to successfully terminate the process after that step has finished. Any input would be much appreciated. Thanks.

Re: system stored procedure question

Phil Brammer

Wrong forum. Moving from SSIS to SQL Server Database Engine.

Re: system stored procedure question

Arnie Rowland

That would be rather complex to put together.

You would be better served by extracting that one step into a separate Job.

Re: system stored procedure question


For an update here if anyone else needs it.

1.) I used the sp_help_jobstep to first get the current on_success_action and step_id, had to go from step_name which was user input to step_id.

2.) Use sp_update_jobstep to change on_succuss_action to terminate after current step.

3.) Start job using sp_start_job

4.) Use sp_update_jobstep again to update the on_success_action to what it originally was.