Posted on 2014-01-10
One of our developers asked if there is a way acquire a read lock, and obtain a write lock if a certain condition is met, to update a particular row. This will be contained in a stored procedure that will run many times throughout the day. At times the stored procedure will run more or less at the same time another process runs the same stored procedure. He does not want one process to update the record while another process is attempting to work on the same record. My knowledge of locking is rather poor, so I could not answer how to accomplish this. Any suggestions will help.