SQL Server ACCRINT Function
Updated 2023-10-06 11:45:14.720000
Description
Use the scalar function ACCRINT to calculate the accrued interest for a security that pays periodic interest.
Syntax
SELECT [westclintech].[wct].[ACCRINT] (
<@Issue, datetime,>
,<@First_interest, datetime,>
,<@Settlement, datetime,>
,<@Rate, float,>
,<@Par, float,>
,<@Frequency, float,>
,<@Basis, nvarchar(4000),>
,<@Calc_method, bit,>);
Arguments
@Issue
the issue date of the security. @Issue is an expression that returns a datetime or smalldatetime value, or a character string in date format.
@First_interest
the first interest payment date of the security. @First_interest is an expression that returns a datetime or smalldatetime value, or a character string in date format.
@Settlement
the settlement date occurring within the coupon period of the security. @Settlement is an expression that returns a datetime or smalldatetime value, or a character string in date format.
@Rate
the coupon rate of the security expressed in decimal terms. @Rate is an expression of type float or of a type that can be implicitly converted to float.
@Par
the par value of the security. @Par is an expression of type float or of a type that can be implicitly converted to float.
@Frequency
the number of coupon payments per year. For annual payments, @Frequency = 1; for semi-annual, @Frequency = 2; for quarterly, @Frequency = 4; for monthly, @Frequency = 12. @Frequency is an expression of type float or of a type that can be implicitly converted to float.
@Basis
is the type of day count to use. @Basis is an expression of the character string data type category.
| Basis | Day count basis |
|---|---|
| 0 or omitted | US (NASD) 30/360 |
| 1 | Actual/Actual |
| 2 | Actual/360 |
| 3 | Actual/365 |
| 4 | European 30/360 |
@Calc_method
@Calc_method is a logical value that specifies the way to calculate the total accrued interest when the date of settlement is later than the date of first interest. A value of TRUE() returns the total accrued interest from issue to settlement. A value of FALSE() returns the accrued interest from first_interest to settlement. If @Calc_method is NULL it defaults to TRUE(). @Calc_method is an expression of type bit or of a type that can be implicitly converted to bit.
Return Type
float
Remarks
If @Frequency is any number other than 1, 2, 4 or 12, ACCRINT returns an error.
If @Basis < 0 or @Basis > 4, ACCRINT returns an error.
Examples
SELECT wct.ACCRINT('03/01/2008'
,'08/31/2008'
,'03/03/2008'
,0.1
,1000
,2
,0
,0);
Here is the result set
| column 1 |
|---|
| 0.555555555555556 |
See Also
ACCRINTM - Calculate the accrued interest for a security that pays interest at maturity.
ODDFINT - Accrued interest for a bond with an odd first coupon
ODDLINT - Accrued interest for a bond with an odd last coupon
BONDINT - Accrued interest on a bond paying regular, periodic interest
AIFACTOR - Calculate the Accrued Interest Factor
AIFACTOR_IAM - Calculate the Accrued Interest Factor for an Interest-at-Maturity security
AIFACTOR_OFC - Calculate the Accrued Interest Factor for a bond during its odd first coupon period
AIFACTOR_OLC - Calculate the Accrued Interest Factor for a bond during its odd last coupon period
BONDAMORT - Bond amortization schedule using constant effective daily interest method