Question: how to calculate years and months between two dates in sql?
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.