问题描述
我只安装了 SQL Server 2008R2,但我需要与拥有 2005 的客户沟通.
I have only SQL Server 2008R2 installed though I need to communicate with customers having 2005.
[1] 告诉:
"NOLOCK
这不会锁定任何对象.这是 SELECT 操作的默认设置.它不适用于 INSERT、UPDATE 和 DELETE 语句"
This does not lock any object. This is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements"
[2] 似乎没有提到它,但我在 SSMS/SS 2008R2 中的检查表明 nolock 不是 SELECT 的默认提示.
[2] doesn't seem to mention it, but my checking in SSMS/SS 2008R2 shows that nolock is not default hint for SELECT.
WITH(NOLOCK) 真的是 SQL Server 2005 SELECT 的默认设置吗?
BOL2005/2008在哪里写的?
Is WITH(NOLOCK) really default in SQL Server 2005 SELECT?
Where is it written in BOL2005/2008?
更新:
在它写在哪里"下,我希望看到 [1] 部分引用的所有内容的答案/评论/说明(或者更好的引用):
Update:
Under "Where is it written" I expected to see answers/comments/clarifications (or, better, citations) on all cited from [1] parts:
这不会锁定任何对象"
"This does not lock any object"
没有 NOLOCK 的 SELECT 是否会在 SQL Server 2005 中放置任何锁(具有默认隔离级别 READ UNCOMMITTED)?
...在 SQL Server 2008 中(分别具有 READ COMMITTED)?
Does SELECT without NOLOCK put any any locks in SQL Server 2005 (having default isolation level READ UNCOMMITTED)?
... in SQL Server 2008 (resp. having READ COMMITTED)?
我所读到的内容可以理解为 NOLOCK 允许忽略/绕过另一个事务放置的现有锁......但目前尚不清楚当前事务(SELECT with NOLOCK)是否放置(或尝试放置)自己的锁...
What I have read on it can be understood that NOLOCK permits to ignore/bypass existing locks put by another transaction... but it was quite unclear whether current transaction (SELECT with NOLOCK) puts (or trying to put) its own locks...
READ UNCOMMITTED 隔离级别(用作使用 NOLOCK 提示的同义词)是否意味着没有任何锁定?
Does READ UNCOMMITTED isolation level (which is used as synonym to using NOLOCK hint) imply absence of any locking?
它不适用于 INSERT、UPDATE 和 DELETE 语句"
好像是对的?
是因为它们(INSERT、UPDATE 和 DELETE)总是锁定而 SELECT 不锁定吗?
等
"It does not apply to INSERT, UPDATE, and DELETE statements"
It seems to be correct?
Is it because they (INSERT, UPDATE, and DELETE) always lock but SELECT doesn't?
etc.
[1]
http://blog.sqlauthority.com/2007/04/27/sql-server-2005-locking-hints-and-examples/
[2]
SQL Server 2005 联机丛书.表提示 (Transact-SQL)
http://msdn.microsoft.com/en-us/图书馆/ms187373(SQL.90).aspx
推荐答案
参见 重复
NOLOCK 不是默认值,不能设置为默认值.SQL 权限链接显然是错误的.
NOLOCK is not the default and can not be set as such. The SQL Authority link is plainly wrong.
这篇关于NOLOCK 是 SQL Server 2005 中 SELECT 语句的默认值吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!