Table variables and transactions do not mix the way temporary tables do, because a ROLLBACK leaves the rows in a table variable. The tests here cover a full rollback, a savepoint, a failed statement and a logging pattern, all on SQL Server 2025.
Why a Second Log File Does Not Make Anything Faster
Adding a second log file feels like a speed fix, but it is only a spare room. Here is how to watch it work and how to retire it.
Why a Clustered Index Does Not Guarantee Order Without ORDER BY
Explain order without ORDER BY through parallel scans, NOLOCK allocation scans, alternate indexes, shared scans, and the explicit sort fix.
Shortest Distance Between Two Shapes in SQL Server: Ramsetu or Adam’s Bridge
The shortest distance between two shapes in SQL Server comes from ShortestLineTo and STDistance. The tests here show the numbers behind the three original pictures, what happens when shapes overlap or use different SRIDs, and the same method on the globe near Ramsetu.
MultiSubnetFailover: Why Clients Time Out After an AG Failover
Diagnose an AG failover timeout with listener DNS, MultiSubnetFailover, RegisterAllProvidersIP, HostRecordTTL, and client-driver checks.
Replacing a Running Total Cursor With a Window Function
That loop adding to a variable can usually become one window function. Here is the proof that the balances match, and the tie trap to watch for.
Reading a Backup File Before You Restore With RESTORE HEADERONLY
Use RESTORE HEADERONLY to identify backup sets, source versions and finish dates before selecting a restore and checking the media.
SQL Server Indexing Basics: SQL in Sixty Seconds #006
SQL Server indexing basics start with the query you want to help. The tests here use a 200,000 row table to compare a scan, a plain index and a covering index, show when SQL Server ignores an index, and measure what three extra indexes cost on an insert.
Intra-Query Parallel Deadlock: When One Query Blocks Itself
No error, no deadlock graph, just a report that is slow on some runs. Here is a demo where one query deadlocks with itself, and how to fix it.
A Separate Clustered Index for a Nonclustered GUID Primary Key
The primary key and the clustered index are two different jobs. This demo keeps the GUID as the public ID and clusters on an identity column instead.










