home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,130 of 19,505   
   Erland Sommarskog to omtechguy   
   Re: NOLOCK Declaration - one time for al   
   23 Feb 11 00:03:12   
   
   9e100b27   
   From: esquel@sommarskog.se   
      
   omtechguy (omtechguy@gmail.com) writes:   
   > Is there an option to declare one time at the beginning of the SP that   
   > all the selects will run with NOLOCK command instead of writing if   
   > after each table name?   
      
   I will be blunt: you should only use NOLOCK if you have full understanding   
   of the consequences, and it is obvious that you don't.   
      
   When using NOLOCK, you may read uncommitted data, but you may also fail   
   to read *committed* data. You may get faster execution and less blocking,   
   but what does that help if you get incorrect results.   
      
   Overall, understanding the implications of NOLOCK can be difficult also   
   for an expert. Not the least if there are updates in the mix.   
      
   As Bob said, you should investigate snapshot isolation. You may also   
   need to review indexing to improve performance and reduce blocking   
   that way.   
      
      
   --   
   Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se   
      
   Links for SQL Server Books Online:   
   SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx   
   SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca