See how table variables survive rollback to retain error details, then write a permanent error log after a failed SQL Server transaction.
Single-Row Inserts in a Loop: Why Commits Cost So Much
A loop that inserts one row at a time waits for the log on every row. Here is how to see it, and three ways to wait far less.
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.
State Machine in T-SQL: Allowed Status Changes for an Order
A state machine in T-SQL keeps the allowed status changes in a table and rejects every other change. This post builds one for orders with a transitions table and a trigger, then tests a bad jump, several rows in one UPDATE, new orders, a transaction and a new rule. Every result comes from SQL Server 2025.
A T-SQL Cheat Sheet for Everyday Work
This T-SQL cheat sheet gathers daily SELECT, JOIN, GROUP BY, window, TRY_CONVERT, and transaction patterns with short examples.







