March 31, 2005 at 11:22 pm
Hi
I am suffering from lost update problem.
Like if multiple transactions are running concurrently they all want to modify a record only after checking the status of a field in the record but it may happen that 2 or more transaction read the same status and update the record and only update of last transaction will persist.
What I want if record is reading by someone that should be locked until it reads and updates and them commit the transaction.
How it can be achieved in SQL Server
April 4, 2005 at 8:00 am
This was removed by the editor as SPAM
April 4, 2005 at 8:19 am
To solve this you could use the HOLDLOCK and XLOCK locking hints, and run the select and update in a transaction. You could also implement some optimistic concurrency handling this yourself, I give some examples of this in my article Dealing with changing data (http://www.sqlservercentral.com/columnists/chedgate/dealingwithchangingdata.asp). Also check Isolation Levels in BOL.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply