0

I have created the following TSQL:

begin transaction
    update person.Address set addressline2 = 'The Town' where addressid=1 
    WAITFOR DELAY '0:00:010'
    commit

During the ten second delay you are not able to run this SQL statement in another SQL Studio Manager:

SELECT * FROM Person.Address

Or this:

SELECT * FROM Person.Address where addressid=1 

But you are able to run this:

SELECT * FROM Person.Address where addressid<>1

Does SQL Studio Manager choose the lock type? I don't believe it does as you can do this:

SELECT * FROM Person.Address where addressid=1 nolock

I have read this webpage: > http://msdn.microsoft.com/en-us/library/ms175519%28v=sql.105%29.aspx, but I am still unclear.

4

1 回答 1

1

提示 NoLock 还意味着“未提交读取”仅适用于选择语句。因此,它也将允许您查询未提交的数据。请在此处找到文档 ,如果没有提示,引擎将不允许您读取未提交的数据。

于 2013-07-25T21:23:39.223 回答