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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 date

Author  Topic 

wided
Posting Yak Master

218 Posts

Posted - 2010-09-23 : 06:39:14
How to calculate the age of a person
when i have a Date of birth In a given date

(By using the functions date or others functions)

example

Date of birth = '19840922' or other date

given date ='20100930'

thanks

PS: sql2000 or sql2005



pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2010-09-23 : 06:52:39
You need to use datediff function

Have a look at:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=11578
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-09-23 : 13:56:09
http://www.kodyaz.com/articles/calculate-age-sql-code.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2010-09-24 : 04:57:47
thanks visakh16

datediff need year or month .....

if my given date ='20100930'

a person born in '19840921' have 26 year
and a person born in '19841020' have 26 year too
I do not want to show those who were born in October, November and December




Go to Top of Page

wided
Posting Yak Master

218 Posts

Posted - 2010-09-24 : 05:12:51
thnaks visakh16

it is ok

http://www.kodyaz.com/articles/calculate-age-sql-code.aspx is what i need

Go to Top of Page
   

- Advertisement -