如何为 sql server 登录强制 nolock 提示 [英] How to force nolock hint for sql server logins

查看:34
本文介绍了如何为 sql server 登录强制 nolock 提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道一种对某个用户发出的所有交易强制执行 nolock 提示的方法?我想为支持团队提供登录名以查询生产系统,但我想通过强制对他们所做的一切进行 nolock 来保护它.我使用的是 SQL Server 2005.

Does anyone know of a way to force a nolock hint on all transactions issued by a certain user? I'd like to provide a login for a support team to query the production system, but I want to protect it by forcing a nolock on everything they do. I'm using SQL Server 2005.

推荐答案

这是一种痛苦而笨拙的方法,但这就是我们在我工作的地方所做的.我们也使用经典的 asp,所以我们使用内联 sql 调用.我们实际上将 sql 调用包装在一个函数中(在这里您可以检查特定用户)并在调用的开头添加SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED".

This is a painful and hacky way to do it, but it's what we're doing where I work. We're also using classic asp so we're using inline sql calls. we actually wrap the sql call in a function (here you can check for a specific user) and add "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" to the beginning of the call.

我相信在功能上这与无锁提示相同.抱歉,我没有纯粹的 SQL 答案,如果您能找到一个好的方法,我很想知道.

I believe functionally this is the same as the no lock hint. Sorry I don't have a pure SQL answer, I'd be interested to hear if you find a good way to do this.

这篇关于如何为 sql server 登录强制 nolock 提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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