Figuring out the resource a lock in SQL Server 2000 affects
Posted
by Michael Lang
on Stack Overflow
See other posts from Stack Overflow
or by Michael Lang
Published on 2010-04-05T17:17:57Z
Indexed on
2010/04/05
17:23 UTC
Read the original article
Hit count: 195
I am adding a simple web-interface to show data from a commercial off the shelf (COTS) application. This COTS issues locks on any record the user is actively looking at (whether they intend to edit and update it or not).
I have found sp_lock and the Microsoft sp_lock2 scripts and can see the locks, so that's all well and good.
However, I cannot figure out how I can tell if a specific record I am about to update has been affected by one of these locks. If I submit the update request and there is in fact a lock, the web-interface will wait indefinitely until the user closes the window in the COTS.
How can I either:
a) determine before issuing an update that the record has been locked
OR
b) issue an update that will immediately return with a LOCKED status rather than indefinitely waiting on the COTS user to close their window on that record?
© Stack Overflow or respective owner