Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Nolock on updates?

Author  Topic 

CoffeeAddict
Yak Posting Veteran

94 Posts

Posted - 2010-05-21 : 17:38:54
is it not possible to do nolock on an update?

update Transaction nolock
set AuthID = RefundTransID
where id = 12569

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-05-21 : 17:42:12
What would be the point?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-05-22 : 01:58:02
Do not use NOLOCK unless you know what its side effects are and your program is able to handle the errors that will be raised, and the fact that you may get duplicate rows, or missing rows returned.

http://sqlblog.com/blogs/andrew_kelly/archive/2009/04/10/how-dirty-are-your-reads.aspx

If you have Reads blocking Writes then use READ_COMMITTED_SNAPSHOT instead (you just set that on the databases, so you don't then need NOLOCK hints anywhere in your code - but you will need to take ALL existing ones out because of the way they work, unless your program has been specifically built to handle those side effects)
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-05-22 : 04:40:19
Read uncommitted only applies to reads (as it's name implies). All data modifications MUST lock exclusively to ensure database integrity.

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -