Login     Register

        Contact Us     Search

XLeratorDB/engineering Online Documentation

SQL Server function to convert length units of measure


CONVERTLENGTH
 
Updated: 01 December 2008 

Use CONVERTLENGTH to convert to and from fathoms, feet, furlongs, inches, meters, miles, nautical miles, pica, points, or yards.
Syntax
SELECT [westclintech].[wct].[CONVERTLENGTH] (
  <@Length, float,>
 ,<@From_scale, nvarchar(4000),>
 ,<@To_scale, nvarchar(4000),>)
Arguments
@Length
is any real number. @Length is an expression of type float or of a type that can be implicitly converted to float
@From_scale
is the description of the units @Length is being converted from. @From_scale must be a valid value as specified in area unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.
 
@To_scale
is the description of the units @Length is being converted to. @To_scale must be a valid value as specified in area unit representations. @To_scale must be of a data type that is implicitly convertible to varchar.
 
Return Types
float
Remarks
 
inches
in, inch, inches
feet
ft, foot, feet
yards
yd, yard, yards
miles
mi, mile, miles
nautical miles
nmi, nautical mile, nautical miles
furlongs
fur, furlong, furlongs
fathoms
fath, fathom, fathoms
angstroms
å, angstrom, angstroms, ångström, ångströms
picas
pica, picas, pc
points
point, points, pt
kilometers
km, kilometer, kilometers, kilometre, kilometres
hectometers
hm, hectometer, hectometers, hectometre, hectometres
decameters
dam, decameter, decameters, decametre, decametres
meters
m, meter, meters, metre, metres
decimeters
dm, decimeter, decimeters, decimetre, decimetres
centimeters
cm, centimeter, centimeters, centimetre, centimetres
millimeters
mm, millimeter, millimeters, millimetre, millimetres
microns
µm, micron, microns,
nanometers
nm, nanometer, nanometers, nanometre, nanometres
picometers
pm, picometer, picometers, picometre, picometres
femtometers
fm, femtometer, femtometers, femtometre, femtometres
attometers
am, attometer, attometers, attometre, attometres
zeptometers
zm, zeptometer, zeptometers, zeptometre, zeptometres
yoctometers
ym, yoctometer, yoctometers, yoctometre, yoctometres
 
Example
 
select wct.CONVERTLENGTH(.001, 'in', 'µm')
Here is the result set
----------------------
25.4
 
(1 row(s) affected)


Copyright 2008-2013 WestClinTech LLC         Privacy Policy        Terms of Service