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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

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

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

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

In (Som, Ni, Yak)

17689 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

Time is always against us

Go to Top of Page

Patron Saint of Lost Yaks

30421 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  
 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.09 seconds. Powered By: Snitz Forums 2000