cancel
Showing results for 
Search instead for 
Did you mean: 

Any SQL gurus out there?

Community Veteran
Posts: 5,464
Thanks: 1,443
Fixes: 34
Registered: 16-10-2014

Any SQL gurus out there?

I was wondering if there was anyway you can determine if a given procedure is running on a SQL Server Instance? (In this case SQL Server 2014 Enterprise Edition)
For example I have Procedure XXX that can take anything up to N minutes to complete. However when this procedure is running I do not want any other users to be able to execute it. I know I could set a flag in a table to say that this procedure is running, but this approach falls down in the event of a system failure.
In an ideal world it would be a real time way of knowing if the procedure was running. Maybe this can be done using the system catalogues I don't know, which is why I am asking those that might.
2 REPLIES
Community Veteran
Posts: 26,718
Thanks: 931
Fixes: 10
Registered: 10-04-2007

Re: Any SQL gurus out there?

Community Veteran
Posts: 5,464
Thanks: 1,443
Fixes: 34
Registered: 16-10-2014

Re: Any SQL gurus out there?

It certainly does and a lot more elegant than other options I found, thank you for that, very much appreciated.