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.
Author |
Topic |
BruceT
Yak Posting Veteran
78 Posts |
Posted - 2012-06-25 : 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 lockand 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 |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
BruceT
Yak Posting Veteran
78 Posts |
Posted - 2012-06-25 : 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! |
|
|
|
|
|