Why would you ever mix the SNAPSHOT isolation level with an UPDLOCK?
1
vote
2
answers
156
views
[The documentation](https://learn.microsoft.com/en-us/sql/relational-databases/sql-server-transaction-locking-and-row-versioning-guide?view=sql-server-ver16#update) points out that you can use
UPDLOCK
hints while running a transaction under the SNAPSHOT
isolation level. [This more obscure documentation](https://learn.microsoft.com/en-us/dotnet/framework/data/adonet/sql/snapshot-isolation-in-sql-server?redirectedfrom=MSDN#using-lock-hints-with-snapshot-isolation) shows an example. However, I cannot think of any use case!
This is my question: Why would you ever mix the SNAPSHOT
isolation level with an UPDLOCK
? The two big alternatives that come to my mind are simply using a pessimistic isolation level or using the READCOMMITTEDLOCK
hint.
Asked by J. Mini
(1225 rep)
May 10, 2025, 04:40 PM
Last activity: May 13, 2025, 09:02 AM
Last activity: May 13, 2025, 09:02 AM