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 2000 Forums
 Transact-SQL (2000)
 When to use NOLOCK

Author  Topic 

dba123
Yak Posting Veteran

90 Posts

Posted - 2007-03-12 : 12:57:03
do I use NOLOCK for Deletions and Updates rather than just Select statements?

I tried this:

delete from ProductFile
where ProductID in (blah blah blah)

and get the error Line 4: Incorrect syntax near '('.

JohnH
Starting Member

13 Posts

Posted - 2007-03-12 : 13:17:45
Try this:

delete ProductFile
from ProductFile
where ProductID in (blah blah blah)

John Hopkins
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-03-12 : 22:25:11
Have you got some commas in there?

delete from ProductFile
where ProductID in (blah, blah, blah)

Kristen
Go to Top of Page

JohnH
Starting Member

13 Posts

Posted - 2007-03-13 : 16:56:05
... guess I was copy-paste lazy ...

John Hopkins
Go to Top of Page

dba123
Yak Posting Veteran

90 Posts

Posted - 2007-03-13 : 20:41:22
crap, I gave the wrong example. I found out only to use nolock on selects.
Go to Top of Page

dba123
Yak Posting Veteran

90 Posts

Posted - 2007-03-13 : 20:41:58
I thought maybe you could use nolock on updates and delete statements but obviously that's not possible
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-03-14 : 05:04:11
Hehehe ... OK. But FWIW I personally think that NOLOCK on SELECTS is a bad idea too ... it usually indicates "submarining" of a problem, and I take a similar view with DISTINCT ....

What's the underlying problem you are wrestling with?

Kristen
Go to Top of Page
   

- Advertisement -