A slow index turned out to be heavily fragmented. My quick script uses sys.dm_db_index_physical_stats to show index fragmentation details for every index.
SQL SERVER – Simple Puzzle Using Union and Union All – Answer
The answer to yesterday’s Simple Puzzle Using Union and Union All, explained with an image. My UNION vs. UNION ALL article explains why it works.
SQL SERVER – Simple Puzzle Using Union and Union All
A simple puzzle using UNION and UNION ALL: guess the output of two short scripts before you run them. The hint is my article on UNION vs. UNION ALL.
SQL SERVER – 2005 – Mechanisms to Ensure Integrity and Consistency of Databases – Locking and Row Versioning
Books Online describes two mechanisms to ensure integrity and consistency of databases: locking and row versioning. Here is how it defines each one.
SQL SERVER – 2005 – Find Highest / Most Used Stored Procedure
Which stored procedure runs most often? My small SQL Server 2005 script finds the most used stored procedure, with execution count, worker time and calls per second.
SQL SERVER – Introduction to Live Lock – What is Live Lock?
What is Live Lock in SQL Server? How a write request can keep waiting behind a stream of reads, how it differs from a deadlock and how to reduce it.
Solving SQL Puzzles With Set-Based Thinking
Set-based thinking solves three SQL puzzles with grouping, anti-joins, and windows, then turns each solution into a repeatable query habit.
SQL SERVER – Add Column With Default Column Constraint to Table
Add a NOT NULL column with a named default Column Constraint in one ALTER TABLE statement. I always name constraints instead of letting SQL Server pick one.
Simple CASE and NULL: Use a Searched Condition
Simple CASE and NULL do not match through equality. Use a searched IS NULL branch, preserve empty text, and make the result type explicit.










