Logo

SQL Server RECEIVED Function

Updated 2023-10-05 14:38:42.210000

Description

Use the scalar function RECEIVED to calculate the amount received at maturity for a fully invested security.

Syntax

SELECT [westclintech].[wct].[RECEIVED] (
  <@Settlement, datetime,>
 ,<@Maturity, datetime,>
 ,<@Investment, float,>
 ,<@Discount, float,>
 ,<@Basis, nvarchar(4000),>)

Arguments

@Settlement

the settlement date of the security. @Settlement is an expression that returns a datetime or smalldatetime value, or a character string in date format.

@Maturity

the maturity date of the security. @Maturity is an expression that returns a datetime or smalldatetime value, or a character string in date format.

@Investment

the amount invested in the security. @Investment is an expression of type float or of a type that can be implicitly converted to float.

@Discount

the security's discount rate. @Redemption 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.

@BasisDay count basis
0 or omittedUS (NASD) 30/360
1Actual/Actual
2Actual/360
3Actual/365
4European 30/360

Return Type

float

Remarks

If @Investment <= 0 or @Discount <= 0, RECEIVED returns an error.

If @Settlement >= @Maturity, RECEIVED returns an error.

If @Basis < 0 or @Basis > 4, RECEIVED returns an error.

RECEIVED performs the following calculation:

RECEIVED = @investment/(1-(@Discount*DSM/b))

Where

    b = the number of days in the year depending on the year basis

    DSM = the number of days from settlement to maturity

Examples

SELECT wct.RECEIVED('2/1/2008', '5/2/2008', 98975, 0.0475, 0);

Here is the result se t .

column 1
100177.829634992