Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 How do I update the last jobstep of a job?

Author  Topic 

ratinakage
Starting Member

16 Posts

Posted - 2006-02-27 : 10:20:00
Hi all.

I am trying to update the last job step in a job, before adding a final job step to the end of the job. In the below example, the last job step number is 5. but this is not always the case. Is there a way to ask SQL to update the last job step??

Thanks.

exec msdb..sp_update_jobstep @job_name = N'The Office - Batch Process - Data Summary Base Tables',
@step_id = 5,
@on_success_action = 3 ,
@on_fail_action = 3
GO

ratinakage
Starting Member

16 Posts

Posted - 2006-02-28 : 03:30:11
no one...?
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2006-02-28 : 05:35:28
If you want to find the last step..


select j.name, max(step_id)
from msdb..sysjobsteps s
inner join msdb..sysjobs j
on j.job_id = s.job_id
group by j.name
Go to Top of Page
   

- Advertisement -