What would be the best way to calculate someone\'s age in years, months, and days in T-SQL (SQL Server 2000)?
The datediff
function doesn\'t handle year
Quite Old question, but I want to share what I have done to calculate age
Declare @BirthDate As DateTime
Set @BirthDate = '1994-11-02'
SELECT DATEDIFF(YEAR,@BirthDate,GETDATE()) - (CASE
WHEN MONTH(@BirthDate)> MONTH(GETDATE()) THEN 1
WHEN MONTH(@BirthDate)= MONTH(GETDATE()) AND DAY(@BirthDate) > DAY(GETDATE()) THEN 1
Else 0 END)