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
 General SQL Server Forums
 New to SQL Server Programming
 WITH NOLOCK

Author  Topic 

binto
Yak Posting Veteran

59 Posts

Posted - 2010-04-19 : 08:27:42
Hi All,

can I use 'WITH NOLOCK' while inserting into a table.
Please help me,how can I manage Table Lock when insertion and reading are simultaneousely done on a table

Thanks & Regards
Binto Thomas

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2010-04-19 : 08:34:27
NO!

Nolock is only useful when you are writing reporting queries and you are least bothered about real-time data. While inserting/updating you generally would not have to worry about locking since SQL server does good job of managing that.

Harsh Athalye
http://www.letsgeek.net/
Go to Top of Page

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2010-04-19 : 08:34:36
u can't use the WITH(NOLOCK) in the insert,update,delete statement

used for the select statements
select * from tablename WITH(NOLOCK)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-19 : 08:44:51
See my reply to your other post:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=143180
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-04-19 : 09:14:50
Besides, nolock is not a silver bullet. It has downsides. See - [url]http://sqlblog.com/blogs/andrew_kelly/archive/2009/04/10/how-dirty-are-your-reads.aspx[/url]

If you want to be able to read and insert concurrently, consider the snapshot isolation levels

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

- Advertisement -