Compare @@DATEFIRST and SET DATEFIRST, test weekday numbering and week boundaries, and make session rules explicit in SQL reports.
SQL SERVER – Puzzle – Inside Working of Datatype smalldatetime
A developer got odd results when casting strings sent from an app. This puzzle looks at how the smalldatetime datatype works inside SQL Server.
SQL SERVER – Puzzle with Year Function
After my MONTH() contest, here is a puzzle with YEAR function: what do MONTH and YEAR return for the date 0001-1-1, and why? Take a guess first.
MONTH, DATEPART and DATENAME: Getting Month Names and Numbers Right
Use DATENAME for month labels, compare MONTH and DATEPART, control language and culture, and group sales without combining different years.
SQL SERVER – Quiz on knowing DATEPART and DATENAME Behaviors
DATEPART and DATENAME accept a string that holds only a time and fill in the missing date as January 1, 1900. This post keeps the quiz, runs every query on SQL Server 2025 and explains which of the five bonus queries work and why.
SQL SERVER – Trivia – Days in a Year
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 – Interesting Function AGENT_DATETIME
AGENT_DATETIME in msdb converts integer date and time values in YYYYMMDD and HHMMSS format into a datetime. Here is how it works, with examples.







