Logo

NUMPMTS

Updated 2023-10-11 13:17:24.260000

Syntax

SELECT [westclintech].[wct].[NUMPMTS](
  <@FirstPaymentDate, datetime,>
 ,<@LastPaymentDate, datetime,>
 ,<@PmtPerYear, int,>)

Description

Use the scalar function NUMPMTS to calculate the number of payments from the first interest payment date to the last payment date; in other words, the total number of payments over the life of the loan. The number of payments includes the first payment date. If the last payment date is not a regular payment date, then the returned value is the number of whole payment occurring before the specified date.

Arguments

@LastPaymentDate

the last interest payment date of the loan. @LastPaymentDate is an expression of type datetime or of a type that can be implicitly converted to datetime.

@FirstPaymentDate

the first interest payment date of the loan. @FirstPaymentDate is an expression of type datetime or of a type that can be implicitly converted to datetime.

@PmtPerYear

the number of payments per year. @PmtPerYear is an expression of type int or of a type that can be implicitly converted to int.

Return Type

float

Remarks

@PmtPerYear must be 1, 2, 3, 4, 6, 12, 13, 24, 26, 52 or 365.

Examples

In the example, we calculate the number of payments from the 31 st of January, 2014 to the 31 st of December, 2019.

SELECT wct.NUMPMTS('2014-01-31', '2019-12-31', 12) as NUMPMTS;

This produces the following result.

{"columns":[{"field":"NUMPMTS","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"NUMPMTS":"72"}]}