DateDiff years into decimals
If you want a more accurate version of this that accounts for leap years, then you can do this instead:
cast(DATEDIFF(dd, @EndDateTime, i.mat_exp_dte) as float)
/datediff(dd,@EndDateTime,dateadd(yy,1,@EndDateTime))
Try this instead.
DATEDIFF(dd, @EndDateTime, i.mat_exp_dte)/365.0
Dividing int with an int returns int. Divide with a decimal and you will get a decimal as a result.
.0 stands for floating point number, hence calculations include decimals. Without it you calculate integer division.