How 'bout this?
declare @dob as datetime
select @dob = '6/21/1968'
declare @now as datetime
declare @year_diff as tinyint
select @now = getdate()
select @year_diff = datediff(year, @dob, @now)
if DateAdd(year, @year_diff, @dob) > @now
select @year_diff -1
else
select @year_diff
basically, calculate the number of years that have gone by, then add those years back to the date of birth. if the resulting date is in the future, we subtract one from the years as it would indicate that we have not yet reached the birthday in the current year. if the resulting date is in the past, we have already reached the birthday in this year, so we can return the number of years unaltered.
thanks,
mark