I wrote the SQL below to get a person's age based on the Date of Birth (DOB) field on Client table. However, I got an error message: Adding a value to a 'datetime2' column caused an overflow. Can someone help me to fix it? Thanks,
SELECT YEAR(DATEADD(DAY, DATEDIFF(day,CLIENT.DOB,'2017-01-01'),
CAST('0001-01-01' AS DATETIME2)))-1 AS AGE
FROM CLIENT