Validate payloads with JSON_PATH_EXISTS and typed ISJSON in SQL Server 2022, distinguish null from missing, and enforce a clear contract.
Storing Durations and Summing Time Past 24 Hours
Use whole seconds for summing time beyond 24 hours, aggregate safely, format unlimited hours, and convert legacy time values.
Triangular Joins: The Hidden Row Explosion in Self-Joins
A small grouped result can hide a huge pile of row pairs. Here is how to count them and what to do instead.
Computed Column UDFs: Why Every Query on the Table Goes Serial
A computed column that calls a scalar function can block parallel plans for queries that never read it. Here is how to spot it and test a fix.
SQL SERVER – Finding Shortest Distance between Two Shapes using Spatial Data Classes – Ramsetu or Adam’s Bridge
Using ShortestLineTo in SQL Server spatial data classes, I find the shortest distance between two shapes, with a fun Ramsetu, or Adam’s Bridge, example.
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.
Detect a Leap Year in T-SQL: Four Simple Ways
Detecting a Leap Year in T-SQL takes one rule or one date trick. This post tests four ways on SQL Server 2025: the calendar rule, EOMONTH, TRY_CONVERT and DATEDIFF. It shows that all four agree on 209 years, explains the century years that trip people up, and answers how leap years affect date math.







