Measure page density and fragmentation, compare scan reads around a test rebuild, and choose fill factor using workload evidence.
hierarchyid IsDescendantOf: A Node Includes Itself
hierarchyid IsDescendantOf tests membership in a subtree, including its root. These literal paths keep both compared nodes visible and distinguish self from a strict descendant.
SQL SERVER – Puzzle – Error While Converting Money to Decimal
The answer to my puzzle on Converting Money to DECIMAL(5,2): why it fails with arithmetic overflow, and why DECIMAL(7,2) works, since precision includes scale.
CONCAT: Missing Inputs Produce Present Text
CONCAT builds display text from available inputs. Preserve missing-source flags when output alone cannot prove completeness.
Unpivoting Columns Into Rows With CROSS APPLY and VALUES
Use CROSS APPLY and VALUES for unpivoting columns, retain nulls deliberately, preserve labels, and turn paired fields into aligned rows.
geometry STIsEmpty: Empty Shapes Are Different From SQL NULL
geometry STIsEmpty tests whether an existing spatial instance has an empty point set. I keep that condition separate from SQL NULL. A missing database value and a present empty geometry are different inputs.
How to Practise SQL Without a Real Database
You can practise SQL with small invented tables, generated rows, and repeatable exercises without access to a company's production database.







