0

I execute

EXEC msdb.dbo.sp_start_job N'myjob'

for start my job then after in a loop i execute

EXEC msdb.dbo.sp_help_job @job_name =  N'myjob'

then this return 4 tables, in first table I took

current_execution_status

then if this is equals to

1,2 or 3 I considerate this is Executing but if this is diferent to these values I considerate this has finished (maybe it failed or it finished correctly, but it has finished) then as this has finished I start the process again .......

EXEC msdb.dbo.sp_start_job N'myjob'

but after a time (this works good some time (variable time) and after I got

the job myjob is already running from a request by user ...

I believe my error is considerating values (1,2,3) with current_execution_status maybe i need considerate more values, is not it? what values?

is there a best way? or a easier way? thanks

angel
  • 4,474
  • 12
  • 57
  • 89

1 Answers1

0

This gives you the values. In fact, I think that if any value is returned then your job is running. If you want this job to run continuously, then why not start it as the final step of the job itself?

simon at rcl
  • 7,326
  • 1
  • 17
  • 24