This article is half-done without your Comment! *** Please share your thoughts via Comment ***
The Read Uncommitted Isolation level permits you to read uncommitted data.
The transaction is completed or not, it doesn’t matter because It has never issued the share locks and it allows other transactions to modify data that you are reading.
Anytime you can read your data without any locking issues, but sometimes it generates unexpected results because the data returned by the SELECT are dirty data or in a half state only.
Below is a small demonstration to read uncommitted data.
Now, test this READ UNCOMMITTED isolation level:
First, create a table with sample data:
1 2 3 4 5 6 7 8 9 10 11 12 |
CREATE TABLE tbl_Employee ( EmpID INTEGER ,EmpName VARCHAR(50) ) GO INSERT INTO tbl_Employee VALUES (1,'Anvesh'),(2,'Neevan') ,(3,'Roy'),(4,'Martin') GO |
Open a new query window or session and executing below script:
1 2 3 4 |
BEGIN TRANSACTION UPDATE tbl_Employee SET EmpName ='Jenny' WHERE EmpID=1 WAITFOR DELAY '00:00:15' COMMIT |
During the delay of 15 seconds, Open a new query window or session and try to SELECT this table under READ UNCOMMITED isolation level:
1 2 |
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED SELECT *FROM tbl_Employee |
Now, you can SELECT Uncommitted data.