I found today that a client of mine has been calculating age based on this calcuation:
datediff(year, BIRTH_DATE, getdate())
Because of how the DATEDIFF function works, this is a crude way to calculate age. The problem with DATEDIFF is that it counts "1" if the two years being compared are different by one year. For example, datediff(year, '12/31/2005', '1/1/2006') gives an answer of 1, but obviously those dates are not a year apart as we would think of it.
So, if you use the calculation of datediff(year, BIRTH_DATE, getdate()) to calculate age, you've prematurely advanced the age of anyone whose birthday has not yet occurred in the current calendar year. That's very important to avoid if you are calculating age for insurance or other age-based programs your organization might be running.
Doing a quick search on the internet, I found the following formula on this page:
DECLARE @birthdate SMALLDATETIME, @endDate SMALLDATETIME
SET @birthdate = '19740224'
SET @endDate = GETDATE()
SELECT DATEDIFF
(
YEAR,
@birthdate,
@endDate
) - CASE
WHEN 100 * MONTH(@endDate) + DAY(@endDate)
< 100 * MONTH(@birthdate) + DAY(@birthdate)
THEN 1 ELSE 0 END
As the article suggests, you might want to make this into a function if you are on SQL Server/MSDE 2000 or higher.
Be sure to consider this concept of how the DATEDIFF function works anytime you are using it, so you don't create a similar "overcounting."
I think there was a discussion of this on NiUG sometime ago but googling was easier than searching NiUG's archives.