Adam Gojdas (5/28/2010)
Another way to calculate the age is:
SELECT (ABS(CAST(CONVERT(char(8),GETDATE(),112) AS int)
- CAST(CONVERT(char(8),@DOB,112) AS int)) / 10000) [AGE];
Here is a link to where I originally saw this type of calculation. It is in the comments section. :
http://www.sqlmag.com/article/tsql3/datetime-calculations-part-5.aspx
Careful now... Because of the date conversions to the CHAR datatype, that will be relatively slow.
--Jeff Moden
Change is inevitable... Change for the better is not.