SQL Server NOLOCK keyword

后端 未结 2 874
闹比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.

    0 讨论(0)
  • 2021-01-24 02:34

    Both. And it will also read uncommitted data from other [uncommitted] transactions (if any).

    0 讨论(0)
提交回复
热议问题