Using DATЕDD()
and DATEPART()
is an option:
SELECT DOB
FROM (VALUES
(CONVERT(date, '19971207')),
(CONVERT(date, '19700607')),
(CONVERT(date, '19771207')),
(CONVERT(date, '19971108'))
) d (DOB)
WHERE
DATEPART(year, DATEADD(year, 50, DOB)) = 2020 AND
DATEPART(quarter, DATEADD(year, 50, DOB)) = 2
Result:
DOB
1970-06-07
0
solved Is there any way to calculate age of a person based on DOB and quarter of the provided year sql server? [closed]