Logo

SQL Server CUMIPMT Function

Updated 2023-10-06 21:31:47.517000

Description

Use the scalar function CUMIPMT to calculate the cumulative interest paid on a loan between any two periods.

Syntax

SELECT [westclintech].[wct].[CUMIPMT] (
  <@Rate, float,>
 ,<@Nper, float,>
 ,<@PV, float,>
 ,<@Start_period, int,>
 ,<@End_period, int,>
 ,<@Pay_type, int,>)

Arguments

@Rate

the interest rate per period. @Rate is an expression of type float or of a type that can be implicitly converted to float.

@Nper

the period in the annuity for which the principal payment is being calculated. @Nper is an expression of type float or of a type that can be implicitly converted to float.

@PV

the present value of the future payments . @PV is an expression of type float or of a type that can be implicitly converted to float.

@Start_period

the first period in the calculation. Payment periods are numbered beginning with 1. @Start_period is an expression of type int or of a type that can be implicitly converted to int.

@End_period

the last period in the calculation. Payment periods are numbered beginning with 1. @End_period is an expression of type int or of a type that can be implicitly converted to int.

@Pay_type

the number 0 or 1 and indicates when payments are due. @Pay_type is an expression of type int or of a type that can be implicitly converted to int. If @Pay_type is NULL it is assumed to be 0.

Set @Pay_type equal toIf payments are due
0At the end of a period
1At the beginning of a period

Return Type

float

Remarks

If @Rate <= 0, @Nper <=0, or @PV <=0, CUMIPMT returns an error.

If @Start_period < 1, @End_period <1, or @Start_period > @End_period, CUMIPMT returns an error.

If @Pay_type is any number other than 0 or 1, CUMIPMT return an error.

Examples

SELECT wct.CUMIPMT(0.0075, 360, -125000, 349, 360, 0);

Here is the result set

column 1
568.35255468914