Home > DeveloperSection > Forums > How to find out age of person in sql server?
Pravesh Singh

Total Post:411

Points:2881
Posted on    September-15-2012 1:07 AM

 MSSQL Server MSSQL Server 
Ratings:


 3 Reply(s)
 1812  View(s)
Rate this:
Hello Guys,.
I've suffering with a problem since last night, actually I've a date of birth(DOB) of any person and I want to find out the current age of that person but I don't have any idea about it. Can you tell how do this?

Please resolve my problem.


Carl Pieterson
Carl Pieterson

Total Post:14

Points:98
Posted on    September-27-2012 3:31 AM

you can use datediff() function to find out age of person in sql server.

Pravesh Singh

Total Post:411

Points:2881
Posted on    October-20-2012 9:00 AM

Post is removed by the Admin.

Vijay Shukla

Total Post:100

Points:700
Posted on    December-07-2012 3:18 AM

Hi, Mr. Pravesh Singh
you can use simple query for solving your problem.

SELECT DATEDIFF(year,'1989-12-05',getdate()) 'Age'

Here DateDiff() is a Sql aggregate Function that will return difference between two dates, and getdate() method will return current system DateTime.


Don't want to miss updates? Please click the below button!

Follow MindStick