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
 New to SQL Server Programming
 Retirement Age Blues

Author  Topic 

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2006-08-08 : 16:14:43
Datediff won't give you an age.

For example:

SELECT (((DATEDIFF(DAY,BIRTHDATE,GETDATE())) / 30) / 12) as AGE

is CLOSE but not accurate. Is there another function I should consider in determining age?

Semper fi and Thanks!

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-08 : 16:26:15
You can try this function. It returns age in years, months, and days.

Age Function F_AGE_YYYY_MM_DD
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=62729


Haven't seen you around for a while.

CODO ERGO SUM
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2006-08-08 : 16:32:26
Thanks, Colonel! I should have read your postings first!

The reason you don't see me as much is that I have nothing to post. Your knowledge has gone way beyond what I possess. So, I read.

Thanks again!



Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2006-08-08 : 16:37:29
quote:
Originally posted by Xerxes

Thanks, Colonel! I should have read your postings first!

The reason you don't see me as much is that I have nothing to post. Your knowledge has gone way beyond what I possess. So, I read.

Thanks again!



Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!



Then you should try and answer some stuff...but test it out first



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-08-08 : 16:39:57
Well, if you're interested, I put together this list of links about Date/Time stuff.

Date/Time Info and Script Links
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64762



Don't be a stranger. Drop us a post every now and then over at The Yak Corral.





CODO ERGO SUM
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2006-08-08 : 16:40:16
Hey Xerxes! Long time no see...

My own personal theory as to why you haven't been around much is that you've gone "set-based" on us and that solved all your problems



Be One with the Optimizer
TG
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2006-08-08 : 16:44:29
Naw, I haven't gone 'set-based' I've actually been awfully busy. Got lotsa kids and trying to find a publisher for my sci-fi novel. Plus I'm building a new house--I'd like to be in it before I hit 50 next year.

Thanks for for the 'welcome back!" I'll hit the Corral later this week!

I still read a lot of what you all post!!!





Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page

Xerxes
Aged Yak Warrior

666 Posts

Posted - 2006-08-08 : 18:02:18
quote:
Originally posted by X002548

quote:
Originally posted by Xerxes

Thanks, Colonel! I should have read your postings first!

The reason you don't see me as much is that I have nothing to post. Your knowledge has gone way beyond what I possess. So, I read.

Thanks again!



Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!



Then you should try and answer some stuff...but test it out first



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam




You're right, Brett! Thanks for the advice!

Semper fi,
XERXES, USMC(Ret.)
------------------------------------------------------
The Marine Corps taught me everything but SQL!
Go to Top of Page
   

- Advertisement -