Logo

FRAC2DEC

Updated 2023-11-10 14:57:43.840000

Syntax

SELECT [westclintech].[wct].[FRAC2DEC] (
   <@Frac, nvarchar(4000),>)

Description

Use the scalar function FRAC2DEC to convert a fraction, as text, to a numeric value.

Arguments

@Frac

is the fraction value, as text, to be evaluated. The @Frac argument can be of data types that are implicitly convertible to nvarchar or ntext.

Return Type

float

Remarks

FRAC2DEC always returns the floating point value of the fraction.

Examples

select wct.FRAC2DEC('355/113');

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"3.14159292035398"}]}
select 355 / 113;

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"3"}]}
select cast(355 as float) / cast(113.00 as float);

This produces the following result.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"3.14159292035398"}]}