Friday, February 24, 2012

Checking to see if a sqlagent job is running?

Hi all,
I am starting with the very basics to check to see if a job is running
before I kick off another job. I go to my dev server, see that a job is
running through EM, open query analyzer and run:
Use msdb
go
select run_status from sysjobhistory
where run_status = 4
and it returns 0 rows. I go back to EM and refresh the job and it is still
running. It's history says it runs for 10 minutes or so each run. According
to BOL I should see at least one row for this job that is running. Can
someone show me the error of my ways? Thanks. BTW, I have tried searching on
this topic, but have not come up with anything very helpful.
JackieJackie,
Try:
EXECUTE MSDB.DBO.SP_HELP_JOB @.EXECUTION_STATUS = 1
HTH
Jerry
"Jackie Brophy" <jbrophy@.mathworks.com> wrote in message
news:u3ekuDnzFHA.3720@.TK2MSFTNGP14.phx.gbl...
> Hi all,
> I am starting with the very basics to check to see if a job is running
> before I kick off another job. I go to my dev server, see that a job is
> running through EM, open query analyzer and run:
> Use msdb
> go
> select run_status from sysjobhistory
> where run_status = 4
> and it returns 0 rows. I go back to EM and refresh the job and it is still
> running. It's history says it runs for 10 minutes or so each run.
> According to BOL I should see at least one row for this job that is
> running. Can someone show me the error of my ways? Thanks. BTW, I have
> tried searching on this topic, but have not come up with anything very
> helpful.
> Jackie
>

No comments:

Post a Comment