Logo

SQL Server DOLLARFR Function

Updated 2023-10-12 14:46:29.270000

Description

Use the scalar function DOLLARFR to convert a dollar price, expressed as a decimal number, into a dollar price, expressed as a fraction.

Syntax

SELECT [westclintech].[wct].[DOLLARFR] (
  <@Decimal_dollar, float,>
 ,<@Fraction, int,>)

Arguments

@Decimal_dollar

the decimal number to be converted. @Decimal_dollar is an expression of type float or of a type that can be implicitly converted to float.

@Fraction

the integer to be used as the denominator in converting the fraction. @Fraction is an expression of type int or of a type that can be implicitly converted to int.

Return Type

float

Remarks

If @Fraction is less than zero, an error will be returned.

If @Fraction is equal to a zero, a divide by zero error will be returned.

Examples

SELECT wct.DOLLARFR(1.921875, 64);

Here is the result set.

column 1
1.59

See Also

DOLLARDE - Dollar - fraction to Decimal