sql-servertransactionssnapshot-isolationread-committed-snapshot

Can you still lock rows exclusively (block readers) in a SQL Server db that has Snapshot Isolation and RCSI enabled?


Can you still lock rows exclusively (block readers) in a SQL Server db that has Snapshot Isolation and RCSI enabled?

I want to basically do a xlock, rowlock select on a table.


Solution

  • Yes, you can lock rows exclusively (either using DML or locking hints). But readers also using snapshot isolation will not be blocked because they don't take locks (on data).

    After all, not locking and blocking is a prime advantage of snapshot isolation.