Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Table exclusive lock

$
0
0

I have one session opened and I execute the query:

BEGIN TRAN
SELECT * FROM Inventory with (updlock, holdlock) WHERE ItemID = 796

Transaction is still opened.
If i open the second window, and I execute the following query:

SELECT * FROM Inventory WHERE ItemID = 796

i should'n see the result, since previous transaction should hold exclusive lock on inventory table(lock on entire table). 
I have default read committed isolation level - but if there is holdlock, no matter of transaction level, nobody should't read the row with id=796 (unless select is executed with hint: "with nolock").

Why I can read the locked table from other session? What should i change?

br, Simon


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>