|
BruceT
Yak Posting Veteran
USA
77 Posts |
Posted - 06/25/2012 : 14:14:11
|
Hi all,
I'm sure this is simple, but I'm having a bad case of vision paralysis at the moment! How can I tell if a SQL Job is running? I need to display a message in an end-user app informing them if a SQL Job that runs a stored procedure is running or not. The logged in user is going to have limited permissions so they can't query the msdb.dbo.sysjobs and sysjobactivity tables directly. I've tried
SELECT APPLOCK_TEST('public', 'MyJob', 'Exclusive', 'Session') as lock
and it always returns 1 whether the job is running or not. I'm missing something simple, I just can't see it! I know this is going to be "forehead smack, I'm an idiot" moment!
Thanks |
|
|
BruceT
Yak Posting Veteran
USA
77 Posts |
Posted - 06/25/2012 : 14:29:01
|
Thanks Tara, unfortunately the typical user's permissions are pretty locked down and it's unlikely they will have execute rights on msdb. Ah, here's thought! I can create a function call with an execute as an elevated user that returns the job info! That should work, I think!
|
 |
|