sql server - why the row is not blocked? -
i using transaction in sql server managemnet studio 2012
begin transaction select * tabl1 with(xlock, rowlock) id = 1153; select * table2; rollback
i set breakpoint in sec query. first query block row of pieza id 1153 while transaction not commit or rollback, when code stop in breakpint, in instance of sql server management studio do:
select * table1
this query think wating until transaction of first sql server management studio finish, las query can finish without problem.
however if in t-sql in transaction ef row blocked.
i have tried too:
begin transaction select * tabl1 with(xlock, rowlock) id = 1153; go select * table2; rollback
but not solve problem.
how can seek hints of sql server in management studio?
thanks.
edit:
this transaction blocks row:
begin transaction select * tabl1 with(xlock, rowlock);
select * table2; rollback
so when set status id row not blocked.
from: http://msdn.microsoft.com/en-us/library/ms187373.aspx
lock hints rowlock, updlock, , xlock acquire row-level locks may place locks on index keys rather actual info rows. example, if table has nonclustered index, , select statement using lock hint handled covering index, lock acquired on index key in covering index rather on info row in base of operations table.
so index satisfying first query, sec (select *) can satisfied clusterd index.
sql-server transactions block hint
No comments:
Post a Comment