Original: SQL Server submitted read snapshot test
1. Open the database submitted read snapshot option
2. The database has been submitted to read the test in snapshot mode
A) test table tests
b) Turn on transaction 1, update data C2 = ' 200 ' (not submitted)
BEGIN TRAN UPDATE SET = ' $ ' WHERE = ' A ' -- COMMIT
c) Query data (query is not blocked, C2 = ' 100 ')
SELECT * from Test
d) Turn on transaction 2, update data C2 = ' 300 ' (uncommitted), update operation is blocked (waiting for transaction 1 commit)
BEGIN TRAN UPDATE SET = ' - ' WHERE = ' A ' -- COMMIT
e) COMMIT Transaction 1, re-query the data, the data has been updated to ' 200 ', transaction 2 blocking has been lifted
SELECT * from Test
f) COMMIT TRANSACTION 2, query data, data has been updated to ' 300 '
SELECT * from Test
3. Committed read mode vs committed read Snapshot differences:
A) If a transaction is not committed, the read operation will be blocked
4. Session level Set database isolation level
A) The original isolation level is a read-committed snapshot, and the query is not blocked
b) Session adjustment isolation LEVEL (repeatable Read), query blocked
SQL Server committed read snapshot test