Lock Fundamentals

So far, we've concentrated on the internal consistency maintained by a transaction. We've seen how the automatic begin, commit, and rollback transaction mechanisms make certain that entire transactions are completed or no work is done at all.

It's also important that a transaction be isolated from other activity. A transaction uses locks to prevent others from changing relevant data while the transaction is active.

In this section, you will learn about many characteristics of locks. Let's define some terms before we get started:

  • Lock mode defines how a lock interacts with other processes and locks. We'll look closely at shared, exclusive, update, shared intent, and exclusive intent locks.

  • Lock scope refers to how much data is ...

Get Sams Teach Yourself Transact-SQL in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.