Use of NOLOCK
- NOLOCK is also known and dirty reading or blind reading in SQL Server.
- User can read uncommitted data without any wait by using NOLOCK.
- NOLOCK ignore the any LOCK given to transaction by any SQL user.
Example :
Code :
BEGIN TRANSACTION
UPDATE C
SET C.ContactName=''
FROM Customers C
WHERE C.CustomerId = 2
-------------------------------------------------
select * from Customers WHERE CustomerId = 2
-----------------------------------------------
select * from Customers WITH (NOLOCK) WHERE CustomerId = 2
No comments:
Post a Comment