declare @dt char(8) set @dt = '19760308' select datediff(yy, @dt, getdate()) + case when right(@dt, 4) > right(convert(char(8), getdate(), 112), 4) then -1 else 0 end