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 2005 Forums
 Transact-SQL (2005)
 can I use with(nolock) statement in U

Author  Topic 

khufiamalik
Posting Yak Master

120 Posts

Posted - 2008-12-30 : 06:26:11
can I use with(nolock) statement in Update or Insert query?

bklr
Master Smack Fu Yak Hacker

1693 Posts

Posted - 2008-12-30 : 06:28:56
u can use with(nolock) in insert statement where from clause is used
and we can use in joins also
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-30 : 06:37:31
but keep in mind that this can result in dirty reads sometimes
Go to Top of Page

sakets_2000
Master Smack Fu Yak Hacker

1472 Posts

Posted - 2008-12-30 : 06:37:46
quote:
READUNCOMMITTED and NOLOCK cannot be specified for tables modified by insert, update, or delete operations. The SQL Server query optimizer ignores the READUNCOMMITTED and NOLOCK hints in the FROM clause that apply to the target table of an UPDATE or DELETE statement.
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2008-12-31 : 03:33:20
NoLock is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-31 : 04:04:43
quote:
Originally posted by Nageswar9

NoLock is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.



Nope. Nolock is not the default option unless the isolation level is READ UNCOMMITTED.
Go to Top of Page

NeilG
Aged Yak Warrior

530 Posts

Posted - 2008-12-31 : 04:27:19
quote:
Originally posted by Nageswar9

NoLock is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.




NOLOCK hint must be specified, otherwise locks are created by default
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-31 : 04:31:36
quote:
Originally posted by NeilG

quote:
Originally posted by Nageswar9

NoLock is the default for SELECT operations. It does not apply to INSERT, UPDATE, and DELETE statements.




NOLOCK hint must be specified, otherwise locks are created by default


also depends on your isolation level
Go to Top of Page

Nageswar9
Aged Yak Warrior

600 Posts

Posted - 2008-12-31 : 04:34:15
Ok viaskh and NeilG
Go to Top of Page
   

- Advertisement -