I found this on Google: SELECT FLOOR(DATEDIFF(DAY, @BirthDate, @TargetDate) / 365.25)
Where @TargetDate is the date of today (GETDATE()
in TSQL).
Good luck :)
Snake
2010-05-25 06:17:44
I found this on Google: SELECT FLOOR(DATEDIFF(DAY, @BirthDate, @TargetDate) / 365.25)
Where @TargetDate is the date of today (GETDATE()
in TSQL).
Good luck :)
From here:
SELECT DATEDIFF(hour,@dob,GETDATE())/8766 AS AgeYearsIntTrunc
Use a SQL function. See http://social.msdn.microsoft.com/forums/en-US/transactsql/thread/399a7e87-bc78-47a5-8cc2-2d2436886fd7/