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
精彩评论