Originally posted by tpemckiernan
Hi, I am a bit confused as to what updlock means
For example if I performed
from CONTEXTUALPROCLET q1(UPDLOCK)
what does that updlock mean? Am I locking the row, or the table CONTEXTUAL PROCLET or neither of these?
The problem is that I am getting deadlocks and this is not my code
I am unfamiliar with databases and so any help would be gratefully recieved:
I have several methods like that above, which perform various concrrent queries on the CONTEXTUAL PROCLET database, all containing that UPDLOCK statement.
The method that always causes problems with these methods has a defined access intent of wsPessimisticUpdate which, I understand, locks a row of the table.
updlock is the update lock which holds locks until the end of the statement or transaction,it won't block other users from reading the data but won't allow them to update the data until this lock is released..
Use update locks instead of shared locks while reading a table, and hold locks until the end of the statement or transaction. UPDLOCK has the advantage of allowing you to read data (without blocking other readers) and update it later with the assurance that the data has not changed since you last read it.