gilbert delarosa (9/20/2013)
But they wouldn't be 1 until after their BDayor you could just
DECLARE @DOB DATETIME
SET @DOB='01/01/2013'
SELECT FLOOR((DATEDIFF(DD,@DOB,'01/01/2014')+1)/365.25)
Still doesn't work. Last I heard, you gained a year on your birthday and not the day before (Feb 29 babies sometimes excluded). 🙂
DECLARE @DOB DATETIME
SET @DOB='01/01/2012'
SELECT FLOOR((DATEDIFF(DD,@DOB,'12/31/2012')+1)/365.25)
Results:
---------------------------------------
1
(1 row(s) affected)
--Jeff Moden
Change is inevitable... Change for the better is not.