SQL Server CUMPRINC Function
Updated 2023-06-15 21:29:23.783000
Description
Use CUMPRINC to calculate the cumulative principal paid on a loan between any two periods.
Syntax
SELECT [westclintech].[wct].[CUMPRINC] (
<@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 total number of periods in the annuity to be 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
@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 to | If payments are due |
|---|---|
| 0 | At the end of a period |
| 1 | At the beginning of a period |
Return Type
float
Remarks
If@Rate <= 0, @Nper <= 0, or @PV <= 0, CUMPRINC returns an error
If @Start_period < 1, @End_period < 1, or @Start_period > @End_period, CIMPRINC returns an error
If @Pay_type is any number other than 0 or 1, CUMPRINC returns an error
Examples
SELECT wct.CUMPRINC(0.0075
,360
,-125000
,349
,360
,0);
Here is the result set.
| column 1 |
|---|
| 11500.9866994826 |