Login     Register

        Contact Us     Search

XLeratorDB/strings Online Documentation

SQL Server fraction-to-decimal function


FRAC2DEC

Updated: 30 April 2009

Use FRAC2DEC to convert a fraction, as text, to a numeric value.
 Syntax
SELECT [wctString].[wct].[FRAC2DEC] (
   <@Frac, nvarchar(4000),>)
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 Types
float
Remarks
·         FRAC2DEC always returns the floating point value of the fraction.
Examples
 
select wct.FRAC2DEC('355/113')
 
This produces the following result
----------------------
3.14159292035398
 
(1 row(s) affected)


 
select 355/113
 
This produces the following result
-----------
3
 
(1 row(s) affected)
 


select
cast(355 as float)/cast(113.00 as float)
 
This produces the following result
----------------------
3.14159292035398
 
(1 row(s) affected)


Copyright 2008-2013 WestClinTech LLC         Privacy Policy        Terms of Service