Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jruzarovsky
Starting Member
1 Post |
Posted - 2006-02-27 : 07:23:17
|
| Hi,UPDLOCK locks entire table instead of rows selected by SELECT WITH(UPDLOCK).Imagine this scenario:- Table Items, primary key consists of two rows: ItemCode, ItemSubCode.- Connection "A" executes following statement:SET TRANSACTION ISOLATION LEVEL SERIALIZABLEGOSET implicit_transactions ONGOSELECT * FROM Items WITH (UPDLOCK, ROWLOCK) WHERE ItemCode = '1'- Connection "B" executes the same statement but it chooses ItemCode = '2'Connection "B" stays locked because connection "A" has locked entire table instead of selected rows.Is this behaviour described somewhere in the documentation? How to avoid such table lock without rewriting SQL statements? (Maybe some indexes could help?)Thank youjan |
|
|
|
|
|