EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home T-Sql Calculate Age Based on Date Of Birth

Calculate Age Based on Date Of Birth

E-mail Print

select year(getdate())
- year(DOB)
- case when month(DOB) > month(getdate()) then 1
when month(DOB) < month(getdate()) then 0
when day(DOB) > day(DOB) then 1
else 0
end as age
from Table

Last Updated on Friday, 05 February 2010 20:04