The nodes() method turns each element at a path into one row you can query. This post builds a small catalog of books and reviewers, and shows the two alias errors, query() against value(), the singleton rule, how the row pattern decides the rows, and CROSS APPLY for the next level. Every result comes from SQL Server 2025.
Custom Date Format Strings in SQL Server: MM Is Not mm
Custom date format strings tell FORMAT exactly which parts of a date to show. This post compares CONVERT styles with FORMAT, lists the standard and custom letters, and shows the traps: MM against mm, YYYY against yyyy, month names that sort wrong, and a culture that changes with the session. Every result comes from SQL Server 2025.
Cycle Clipboard Ring in SSMS: SQL in Sixty Seconds #045
To cycle clipboard ring entries in SSMS, press Ctrl+Shift+V after a paste. The clipboard ring is most useful when you copy several names, so this post uses T-SQL to build clean column lists and tests the QUOTENAME and STRING_AGG limits that break a paste.
Spatial Unions in SQL Server: STUnion and UnionAggregate
Spatial unions merge shapes that touch or overlap into one shape. This post uses six land parcels on a flat grid to show STContains, STUnion for two shapes, chained unions, UnionAggregate with GROUP BY, and CollectionAggregate for comparison. Every area and result comes from SQL Server 2025.
Aggregate and Detail Columns in One Query: GROUP BY or OVER
Aggregate and detail columns in one query fail with Msg 8120 until you pick a way to keep the rows. This post compares GROUP BY, a scalar subquery and OVER on one small table, adds PARTITION BY and a share of the total, and then combines GROUP BY with OVER. Every result comes from SQL Server 2025.
Why We Use Code Comments in SQL Server: Say Why, Not What
Why we use code comments comes down to one habit: write the reason, not the action. This post uses a small library table to show single-line and block comments, commenting out a join to test a theory, the Msg 156 trap, nested comments, and whether comments slow a query. Every result comes from SQL Server 2025.
QUERY_OPTIMIZER_HOTFIXES: Turning On Optimizer Fixes per Database
A vendor says to turn on optimizer hotfixes. Here is how I check the setting, try it on one statement, and restore it.







