0

I have a job with 5 steps that are scheduled to run after each other.

I want to have a stored procedure where a user can execute the stored procedure and give the step number as a parameter.

Only this job step then will be executed and no further steps.

What would be the best way to accomplish this?

  • Why does the user have to kick off a job step? Why can they not simply just call the SP kicked off by the job step directly? – Pixelated Dec 3 '14 at 10:03
  • This should be trivial using sp_start_job- see msdn.microsoft.com/en-us/library/ms186757.aspx The only tricky part will be getting the step name from the step number, which you can get from msdb.dbo.sysjobsteps – JNK Dec 3 '14 at 13:30
  • Actually I just read the part where you want no other steps to execute, and that's not supported by SQL Agent jobs as far as I know. However, you COULD read the command from the table I mentioned in the previous comment and run it that way. – JNK Dec 3 '14 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.