开发者

In SQL Server 2005, is it possible to set transaction isolation level on a per-user basis?

开发者 https://www.devze.com 2023-01-16 04:11 出处:网络
In SQL Server 2005, is it possible to auto开发者_StackOverflow中文版matically set transaction isolation level to, say, read uncommitted an a per-user basis?

In SQL Server 2005, is it possible to auto开发者_StackOverflow中文版matically set transaction isolation level to, say, read uncommitted an a per-user basis?

(So for instance, if I set such a login option for user Fred, Fred wouldn't have to remember sprinkle his select statements with NOLOCK hints or remember to add in a set transaction isolation level statement to his sql.)


if it is for stored procs you could have code like this in the procs

if user_name() in('dbo','username','otherusers','bla') 
set transaction isolation level read uncommitted
else
set transaction isolation level read committed

But of course now you have a maintenance problem, all current procs have to be modified

you can also check with suser_sname() but this really becomes a big PITA

you might also be able to use a LOGON Trigger I have not tried and am not sure it will work

0

精彩评论

暂无评论...
验证码 换一张
取 消