SQL Need to calculate age from DOB, no stored procedures or functions or views

I need to calculate age from today in years.   The date is stored in a Varchar(255)  type.   It has a format like  YYYY-mm-dd  ex 1971-02-12.  I am guaranteed it will always be a valid date.  The database version is SQL 2005.

This  must be in T-SQL I can not create a store procedure , function or view.  It is part of an upgrade of an FDA validated database and can not create new.  Don't like it but that's the government regulating.  I know this is easier to do with a function, have down it before with functions.  Do not have that ability at the moment

Thank You
Charles BaldoSoftware DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aranaCommented:
select datediff(hour,'1992-04-09',getdate())/8766  'this is trunc version

select CONVERT(int,ROUND(DATEDIFF(hour,'1992-04-09',GETDATE())/8766.0,0))   ' this is TRUNC version

if you run this two you can see they can ve difference between them you choose the best one for your case. (if you use earlier monthsthen both give the same result)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Charles BaldoSoftware DeveloperAuthor Commented:
Thank You. With a few mods that worked.
0
PortletPaulEE Topic AdvisorCommented:
You might find this article useful.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.