A friend was asked in an interview how to find the days in a year efficiently. Here are the T-SQL methods I tried, plus a small quiz for you.
SQL SERVER – Quiz with DATEADD Function – SQL Puzzle
The DATEADD function returns the last day of the month when the day does not exist, so one month after January 31 is February 28. This post keeps the quiz, runs every query on SQL Server 2025 and explains the month rule and the Msg 517 overflow with the real results.
SQL SERVER – Puzzle – Why Divide by Zero Error
Why does SELECT 10000/(17/17/17) return a divide by zero error? A new puzzle, similar to my decimal rounding one but with a different approach.
SQL SERVER – Puzzle – Why Decimal is Rounded Up?
Why decimal is rounded up in one script and not in the other when both divide 10000 by 17? Try this holiday puzzle before you read the comments.
SQL Puzzle – A Quick Fun with Bit Wise Operator
A quick Friday SQL puzzle on the Bit Wise Operator: SELECT 10 & 10 returns 10, so why do 10 & 0 and 1 & 100 both return zero?
SQL SERVER – Start Services or Stop Services with PowerShell – Question to Readers?
A reader asks why you need the -Force flag to stop services with PowerShell but not to start them. I do not know the answer, so I am asking you.
SQL SERVER – Simple Puzzle with UNION – Part 2
Another back to basics puzzle with UNION: run three queries using UNION ALL, ORDER BY and DISTINCT, then compare their execution plans.





