Click here to Skip to main content
15,888,802 members
Articles / Database Development / SQL Server / SQL Server 2014

Get accurate age by date

Rate me:
Please Sign up or sign in to vote.
4.80/5 (3 votes)
20 Feb 2010CPOL 4.5K  
Get accurate age by date using MS SQL Server

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
19 Feb 2010Alaric Dailey
This would work too :)As an explanation, I use datediff to get the number of days, divide that by the correct number of days in a year (keeping track of leap years, there are only 97 in every 400 years) and then FLOOR the result, thus making sure it doesn't get rounded up accidentally....

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Comments and Discussions