SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Script Library
 Compute Age with sepeate DATE, MONTH, YEAR field
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

prakashms
Starting Member

2 Posts

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

khtan
In (Som, Ni, Yak)

Singapore
17626 Posts

Posted - 04/13/2011 :  04:44:23  Show Profile  Reply with Quote
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
Time is always against us

Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30240 Posts

Posted - 04/13/2011 :  06:24:58  Show Profile  Visit SwePeso's Homepage  Reply with Quote
The age, compared to what? Today?



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000