Skip to content

Instantly share code, notes, and snippets.

/**
* Cumulative Interest
* (SQL Server)
* AzsaturnDx (2022) - No copyright at all
*
* Returns the cumulative interest paid on a loan between @start and @end periods.
*
* @Rate FLOAT - Required. The interest rate.
* @Periods INT - Required. The total number of payment periods.
* @Value INT - Required. The present value.
@vondravl
vondravl / EFFECT.sql
Created June 1, 2022 13:47 — forked from Azsaturndx/EFFECT.sql
EFFECT Function (Effective Annual Interest Rate) - SQL Server
/**
* Effective Annual Interest Rate
* (SQL Server)
* AzsaturnDx (2020) - No copyright at all
*
* Returns the effective annual interest rate, given the nominal annual interest rate and the number of compounding periods per year.
*
* @Rate FLOAT - Required. The nominal interest rate.
* @Periods INT - Required. The number of compounding periods per year.
* @return FLOAT Effective Annual Interest Rate.
@vondravl
vondravl / PMT.sql
Created June 1, 2022 13:47 — forked from Azsaturndx/PMT.sql
PMT Function (Payment) - SQL Server
/**
* Payment (PMT)
* (SQL Server)
* AzsaturnDx (2020) - No copyright at all
*
* Calculates the payment for a loan based on constant payments and a constant interest rate.
*
* @Rate FLOAT - Required. The interest rate for the loan.
* @Periods INT - Required. The total number of payments for the loan.
* @Present FLOAT - Required. The present value, or the total amount that a series of future payments is worth now; also known as the principal.
@vondravl
vondravl / FV.sql
Created June 1, 2022 13:46 — forked from Azsaturndx/FV.sql
FV Function (Future value) - SQL Server
/**
* Future Value (FV)
* (SQL Server)
* AzsaturnDx (2020) - No copyright at all
*
* Calculates the future value of an investment based on a constant interest rate. You can use FV with either periodic, constant payments, or a single lump sum payment.
*
* @Rate FLOAT - Required. The interest rate for the loan.
* @Periods INT - Required. The total number of payments for the loan.
* @Payment FLOAT - Required. The payment made each period; it cannot change over the life of the annuity.
@vondravl
vondravl / IPMT.sql
Created June 1, 2022 13:46 — forked from Azsaturndx/IPMT.sql
IPMT Function (Interest payment) - SQL Server
/**
* Interest Payment
* (SQL Server)
* AzsaturnDx (2020) - No copyright at all
*
* Returns the interest payment for a given period for an investment based on periodic, constant payments and a constant interest rate.
*
* @Rate FLOAT - Required. The interest rate per period.
* @Period INT - Required. Specifies the period and must be in the range 1 to nper.
* @Periods INT - Required. The total number of payment periods in an annuity.
@vondravl
vondravl / financial-functions.md
Created June 1, 2022 13:46 — forked from Azsaturndx/financial-functions.md
Financial functions (SQL SERVER)
@vondravl
vondravl / PPMT.sql
Created June 1, 2022 13:46 — forked from Azsaturndx/PPMT.sql
PPMT Function (Principal Payment) - SQL Server
/**
* Principal Payment
* (SQL Server)
* AzsaturnDx (2020) - No copyright at all
*
* Returns the payment on the principal for a given period for an investment based on periodic, constant payments and a constant interest rate.
*
* @Rate FLOAT - Required. The interest rate per period.
* @Period INT - Required. Specifies the period and must be in the range 1 to nper.
* @Periods INT - Required. The total number of payment periods in an annuity.