Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Script Library
 Compute Age with sepeate DATE, MONTH, YEAR field

Author  Topic 

prakashms
Starting Member

2 Posts

Posted - 2011-04-13 : 04:31:04
I have three data columns like below and want to compute the Age. Please help
BirthDateNUM, BirthMonthNum, BirthYearNum

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-04-13 : 04:44:23
this will convert the 3 separate year, month and day to a date data type

select dateadd(month, BirthMonthNum - 1, dateadd(year, BirthYearNum - 1900, BirthDateNum - 1))
from yourtable



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-04-13 : 06:24:58
The age, compared to what? Today?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -