Use whole seconds for summing time beyond 24 hours, aggregate safely, format unlimited hours, and convert legacy time values.
Cleaning Messy Data With T-SQL
Cleaning messy data With T-SQL means trimming text, parsing dates safely, and preserving rejected source rows for correction and replay.
SQL SERVER – Various Leap Year Logics
Dividing by 4 is not enough to find a leap year. Readers shared various leap year logics in the comments, and here are the best of them.
Leap Year in SQL Server: SQL in Sixty Seconds #004
To find a leap year in SQL Server, ask EOMONTH for the last day of February. I tested the method against the divisibility rule for every year from 1 to 9999 and found no disagreement. The post also shows an inline function, the errors for invalid years and a one-line TRY_CONVERT test.
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.
Date Functions Quiz: What Does DATEDIFF Count?
This Date Functions Quiz asks what DATEDIFF returns for two dates one day apart, when the unit is year. The answer is 1, because DATEDIFF counts boundaries crossed. A tested script shows an age calculation that works, plus DATETRUNC and EOMONTH.
Watermarks for Incremental Extracts
Watermarks for incremental extracts need clear boundaries, durable checkpoints, and a plan for late updates, deletes, and missed rows.







