Guest User

rcsi

a guest
Mar 10th, 2015
246
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Session 1
  2. CREATE DATABASE RCSITest
  3. GO
  4. ALTER DATABASE RCSITEST SET READ_COMMITTED_SNAPSHOT ON
  5. GO
  6. USE RCSITEST
  7. GO
  8. CREATE TABLE [Foo] (a int, b varchar(10))
  9. /*
  10. Create a clustered index to make sure whatever behavior you see isn't just some weird heap issue
  11. */
  12. CREATE CLUSTERED INDEX IX_Foo ON Foo (a)
  13. GO
  14. INSERT INTO Foo (a, b) VALUES ( 1, 'Foo')
  15. GO 100000
  16.  
  17. -- Read table and leave tran open
  18. BEGIN TRAN
  19. SELECT * FROM Foo
  20. --COMMIT
  21.  
  22. -- Session 2
  23. UPDATE Foo SET a = 2, b = 'Bar' WHERE a <> 99
  24.  
  25. -- Session 3
  26. select * from sys.dm_tran_top_version_generators
  27. select COUNT(*) from sys.dm_tran_version_store
RAW Paste Data