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)
 smth about jobs

Author  Topic 

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-05-24 : 05:53:08
Hello.
How could I find which job is currently active (using TSQL). I have one job and I want to know if that job is alredy active or not.

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-05-24 : 05:54:55
select [name] from msdb..sysjobs
where enabled=1

--------------------
keeping it simple...
Go to Top of Page

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-05-24 : 06:19:20
I don't need information if job is enabled or not. I need information if job is currently running.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-05-24 : 06:27:17
quote:
Originally posted by dejjan

I don't need information if job is enabled or not. I need information if job is currently running.



ok, you didn't mention that, you just asked if it's active or not

query through sysprocesses then

--------------------
keeping it simple...
Go to Top of Page

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-05-24 : 06:48:56
OK, I see my job in sysprocesses while it is running, but how to identify my process among all others.
Maybe I could use value in column program_name: 'SQLAgent - TSQL JobStep (Job 0x9B32607C9E387A419F7209ED92730BF6 : Step 2))''. But I don't know to associate it with my job_id.
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-05-24 : 06:55:34
the number you're seeing is the job id, you can then join it with sysjobs to get the name of the job

--------------------
keeping it simple...
Go to Top of Page

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-05-24 : 07:09:37
but my job_id is '7C60329B-389E-417A-9F72-09ED92730BF6'
I see some connection between job_id and '0x9B32607C9E387A419F7209ED92730BF6'. Does it exists some function, or smth else, which transform '0x9B32607C9E387A419F7209ED92730BF6' to '7C60329B-389E-417A-9F72-09ED92730BF6'
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2005-05-24 : 22:22:01
undocumented, explore xp_sqlagent_enum_jobs


http://www.google.com.ph/search?hl=en&q=xp_sqlagent_enum_jobs&meta=


--------------------
keeping it simple...
Go to Top of Page

dejjan
Yak Posting Veteran

99 Posts

Posted - 2005-05-25 : 04:08:56
thanks, I find solution
Go to Top of Page
   

- Advertisement -