If you’ve ever tried to calculate someone’s age in SQL Server, you’ve probably run into the same trap most beginners fall into. You call DATEDIFF(), get a number back, and it looks right. But then someone born in December throws the whole thing off by a year.
This happens because DATEDIFF() counts the number of year boundaries crossed between two dates, not the actual number of full years that have passed. It’s a subtle difference, but it matters a lot when you’re dealing with real people’s birthdays.
In this article, we’ll walk through the correct way to calculate age in SQL Server, why the naive approach fails, and a few variations you’ll actually use in production.