YearFrac in Sql 2005
excel, sql
Solution
Find out the distance between two dates using DateDiff, and then divide that value by 365
EDIT
You could, of course, create your own function to do the job:
create function yearfrac (@d1 datetime, @d2 datetime) returns float
as
begin
return abs(datediff(d, @d1, @d2)) / 365.00
end
Problem
How do I write the YearFrac function that comes with Excel in Sql 2005?