公式与excel中的PMT和PV函数类似。
PMT
create function pv(@rate decimal(18,6),@nper int,@pmt numeric(20,4))returns numeric(20,4)asbegin return @pmt*(1-power(1+@rate,-@nper))/@rateend
PV
create function pmt(@rate decimal(18,6), @nper int, @pv numeric(20,4))returns numeric(20,4)as beginreturn @pv * @rate / (1 – power(1+@rate, -@nper))end