Lock Question - 'U' lock vs. 'X' lock

Posted by Randy Minder on Stack Overflow See other posts from Stack Overflow or by Randy Minder
Published on 2010-05-11T16:30:32Z Indexed on 2010/05/11 16:34 UTC
Read the original article Hit count: 508

Filed under:

I have a couple questions concerning Update (U) locks and Exclusive (X) locks.

1) Am I correct that an 'X' lock is put on a resource when the resource is about to get updated?

2) I'm a little fuzzy on U locks. Am I correct that a U lock is applied when a resource is read and SQL Server thinks it might need to update the resource later? If this is correct, would a 'U' lock only get applied when a read is being done within the context of a transaction? I guess I'm trying to understand under what circumstances SQL Server thinks it might need to update later a row it just read now.

Thanks - Randy

© Stack Overflow or respective owner

Related posts about sql-server