Avatar of Charles Baldo
Charles Baldo
Flag for United States of America asked on

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
Microsoft SQL Server 2005Microsoft SQL Server

Avatar of undefined
Last Comment
PortletPaul

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Arana (G.P.)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Charles Baldo

ASKER
Thank You. With a few mods that worked.
PortletPaul

You might find this article useful.
Your help has saved me hundreds of hours of internet surfing.
fblack61