Question: how to calculate age in years and months from date of birth in sql query?
Answer: Declare@dateofbirthdatetime. Declare@currentdatetimedatetime. Declare@yearsvarchar(40) Declare@monthsvarchar(30) Declare@daysvarchar(30) set@dateofbirth='1986-03-15'--birthdate. set@currentdatetime =getdate()--current datetime. select@years=datediff(year,@dateofbirth,@currentdatetime)-- To find Years.