Locks

SQL Server uses locks to maintain data consistency in a multiuser environment. SQL Server automatically handles locking behavior, and starting with SQL Server 7.0, locking automatically escalates and de-escalates on an as-needed basis.

To help understand why locks are important, look at the banking example shown in Figure 20.1. Suppose that you decide to transfer $100 from checking to savings. Your bank decides to run a report that shows your combined balance for checking and savings. What happens if the report is run while the transfer is in progress? Would the report show a balance of $200 or $100?

Figure 20.1. How locks maintain data consistency.

The answer resides in how SQL Server uses locks to maintain data consistency. When the transaction ...

Get Microsoft® SQL Server™ 2000 DBA Survival Guide, 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.