Two sessions race for 2,000 rows: the check-then-update version leaves 254 rows with two winners, and the one-statement version leaves 2,000 rows with exactly one winner each

Record Checkout in SQL Server: A Visible Lock With an Expiry Time

Record checkout puts the name of the editor and an expiry time on the row, so a screen can show who has it. This post builds it with one UPDATE and proves it with two sessions that race for 2,000 rows. A check-then-update version gives some rows two winners, and the one-statement version never does. It also covers expired locks, late saves and check-in. Every result comes from SQL Server 2025.

Read More