Release another user's lock obtained with sp_getapplock on SQL Server
Posted
by joshperry
on Stack Overflow
See other posts from Stack Overflow
or by joshperry
Published on 2010-04-28T01:38:13Z
Indexed on
2010/04/28
2:03 UTC
Read the original article
Hit count: 439
sql-server
|locking
We have a system that uses sp_getapplock
to create an exclusive mutex any time someone opens an order in the GUI. This is used to prevent multiple people from making changes to an order simultaneously.
Sometimes people will open an order and go home, leaving it open. This effectively blocks anyone from being able to make changes to the order. I then get emails, calls and end up doing a kill <spid>
in enterprise manager. Obviously I've gotten sick of this and want to make a quick self-service webform.
The main problem I've run into is that kill
requires sysadmin privileges, which I do not want to give to the user that the our website runs as. I have tried sp_releaseapplock
but this doesn't let you release another user's lock (even when calling it as a sysadmin).
So, finally my question; does anyone know of an alternative method to release a lock that was obtained by another user using sp_getapplock
?
© Stack Overflow or respective owner