<p>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.</p>

[{'answer_id': 64234, 'author': 'Espo', 'author_id': 2257, 'author_profile': 'https://Stackoverflow.com/users/2257', 'pm_score': 0, 'selected': False, 'text': '<p>You could create a limited user for the support team, and then either write stored procedures or views with the nolock-hint. Then only give access to those and not direct table select access.</p>\n'}, {'answer_id': 67248, 'author': 'Chris Wuestefeld', 'author_id': 10082, 'author_profile': 'https://Stackoverflow.com/users/10082', 'pm_score': 0, 'selected': False, 'text': "<p>As Espo hinted at, I'm pretty sure there's no direct way to do what you're asking. As he said, you can sort-of accomplish it by limiting the user's access to only procs that have built-in NOLOCK coded in them.</p>\n"}, {'answer_id': 67252, 'author': 'DBScissors', 'author_id': 9551, 'author_profile': 'https://Stackoverflow.com/users/9551', 'pm_score': 4, 'selected': False, 'text': "<p>You could configure your support staff's SQL Management Studio to set the default transaction isolation level to READ UNCOMMITTED (Tools->Options->Query Execution->SQL Server->Advanced).  This is functionally the same as having NOLOCK hints on everything.</p>\n\n<p>The downsides are that you'd have to do this for each member of your support team, and they'd have the ability to change the configuration on their SQL Management Studio.</p>\n"}, {'answer_id': 71370, 'author': 'VanOrman', 'author_id': 4550, 'author_profile': 'https://Stackoverflow.com/users/4550', 'pm_score': 0, 'selected': False, 'text': '<p>Unfortunately, restricting the users to SPs defeats the purpose of this.  I was hoping there was some way I could allow them to query everything and thereby enhance their troubleshooting skills.  Thanks for your help guys.</p>\n'}, {'answer_id': 72028, 'author': 'Dan Williams', 'author_id': 4230, 'author_profile': 'https://Stackoverflow.com/users/4230', 'pm_score': 4, 'selected': True, 'text': '<p>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.</p>\n\n<p>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.</p>\n'}, {'answer_id': 297849, 'author': 'Sam Saffron', 'author_id': 17174, 'author_profile': 'https://Stackoverflow.com/users/17174', 'pm_score': 1, 'selected': False, 'text': '<p>OK, you need to clarify what you are trying to do here. </p>\n\n<p>If you are trying to reduce locking on the database and possibly provide your support users with data that may never really get committed in the database. While allowing them to write anything they want to the database, then nolock is the way to go. You will get the added bonus that your user will still be able to increase their isolation level using the SET TRANSACTION ISOLATION LEVEL command.  </p>\n\n<p>If you are trying to restrict the damage they can cause when running stuff against the DB, look at implementing security, make sure they are only allowed read access to your tables and look at stripping all access to stored procs and functions.  </p>\n\n<p>I Find NOLOCK is heavily misunderstood on stack overflow.  </p>\n'}]
['https://Stackoverflow.com/questions/64208', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4550/']