SQL Server NOLOCK keyword

后端 未结 2 873
闹比i
闹比i 2021-01-24 02:13

When a SQL client issues the following command:

select * into tbl2
FROM tbl1 (nolock)
WHERE DateCreated < \'2009/01/01\'

does it mean that <

2条回答
  •  醉梦人生
    2021-01-24 02:21

    It means the first; you're not taking out any locks and therefore the second; you wont be blocked by other open transactions. See MSDN docs on table hints.

    Here's a link to the MSDN docs on transaction isolation levels - might be useful if you're considering using NOLOCK. NOLOCK puts the SQL statement at isolation level read uncommitted. If you have a multi-statement transaction you may be able to set the isolation level at a lower level for the majority of the transaction and raise it where needed, rather than lowering it just on one or more statements in the transaction.

提交回复
热议问题