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.
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.
UPDLOCK and READPAST for Queue Tables
UPDLOCK and READPAST let SQL Server queue workers claim different rows safely when transactions, retries, and completion rules are designed.
Picking Random Winners Fairly With NEWID and CRYPT_GEN_RANDOM
Pick random winners with NEWID or cryptographic randomness, handle weights and unique entrants, and save a draw with its seed and timestamp.
log_reuse_wait_desc: Why the Transaction Log Will Not Shrink
log_reuse_wait_desc tells you why SQL Server cannot reuse its transaction log, so you know why a shrink gives nothing back. This post causes LOG_BACKUP and ACTIVE_TRANSACTION on purpose in a test database on SQL Server 2025, measures the log and fixes each one.







