with(nolock)或(nolock)-有区别吗? [英] with(nolock) or (nolock) - Is there a difference?

查看:835
本文介绍了with(nolock)或(nolock)-有区别吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一切均基于with(nolock)完全适合该情况的假设.

我环顾四周,无法找到使用with(nolock)之间的实际区别:

I've looked around and haven't been able to find if there is an actual difference between using with(nolock):

select customer, zipcode from customers c with(nolock) 

或仅(nolock):

select customer, zipcode from customers c (nolock) 

两者之间在功能上有区别吗?风格?
一个比另一个大,并有可能被弃用吗?

Is there a functional difference between the two? Stylistic?
Is one older than the other and has a chance of being deprecated?

推荐答案

没有功能上的区别,但最终没有WITH的语法将不起作用.已弃用:

There is no functional difference, but eventually the syntax without WITH will not work. This has been deprecated:

select customer, zipcode from customers c (nolock) 

因此,您应该使用以下格式:

So you should be using this format:

select customer, zipcode from customers c with (nolock) 

至少从SQL Server 2008起,就不建议在表提示中不使用WITH关键字.在以下主题中搜索短语Specifying table hints without using the WITH keyword.:

Not using the WITH keyword for table hints has been deprecated since at least SQL Server 2008. Search the following topic for the phrase Specifying table hints without using the WITH keyword.:

http://msdn.microsoft.com/zh-cn/library/ms143729%28SQL.100%29.aspx

(关于是否应该使用nolock的讨论当然是分开的.我已经在这里写过关于他们的博客.)

(Discussions about whether you should be using nolock at all, of course, are separate. I've blogged about them here.)

这篇关于with(nolock)或(nolock)-有区别吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆