CONVERTLENGTH
Updated 2024-02-13 19:18:03.887000
Syntax
SELECT [westclintech].[wct].[CONVERTLENGTH] (
<@Length, float,>
,<@From_scale, nvarchar(4000),>
,<@To_scale, nvarchar(4000),>);
Description
Use the scalar function CONVERTLENGTH to convert to and from fathoms, feet, furlongs, inches, meters, miles, nautical miles, pica, points or yards.
Arguments
@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.
@Length
is any real number. @Length is an expression of type float or of a type that can be implicitly converted to float.
@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 Type
float
Remarks
Length unit representations:
{"columns":[{"field":"inches","width":139},{"field":"in, inch, inches","width":499}],"rows":[{"inches":"feet","in, inch, inches":"ft, foot, feet"},{"inches":"yards","in, inch, inches":"yd, yard, yards"},{"inches":"miles","in, inch, inches":"mi, mile, miles"},{"inches":"nautical miles","in, inch, inches":"nmi, nautical mile, nautical miles"},{"inches":"furlongs","in, inch, inches":"fur, furlong, furlongs"},{"inches":"fathoms","in, inch, inches":"fath, fathom, fathoms"},{"inches":"angstroms","in, inch, inches":"å, angstrom, angstroms, ångström, ångströms"},{"inches":"picas","in, inch, inches":"pica, picas, pc"},{"inches":"points","in, inch, inches":"point, points, pt"},{"inches":"kilometers","in, inch, inches":"km, kilometer, kilometers, kilometre, kilometres"},{"inches":"hectometers","in, inch, inches":"hm, hectometer, hectometers, hectometre, hectometres"},{"inches":"decameters","in, inch, inches":"dam, decameter, decameters, decametre, decametres"},{"inches":"meters","in, inch, inches":"m, meter, meters, metre, metres"},{"inches":"decimeters","in, inch, inches":"dm, decimeter, decimeters, decimetre, decimetres"},{"inches":"centimeters","in, inch, inches":"cm, centimeter, centimeters, centimetre, centimetres"},{"inches":"millimeters","in, inch, inches":"mm, millimeter, millimeters, millimetre, millimetres"},{"inches":"microns","in, inch, inches":"µm, micron, microns,"},{"inches":"nanometers","in, inch, inches":"nm, nanometer, nanometers, nanometre, nanometres"},{"inches":"picometers","in, inch, inches":"pm, picometer, picometers, picometre, picometres"},{"inches":"femtometers","in, inch, inches":"fm, femtometer, femtometers, femtometre, femtometres"},{"inches":"attometers","in, inch, inches":"am, attometer, attometers, attometre, attometres"},{"inches":"zeptometers","in, inch, inches":"zm, zeptometer, zeptometers, zeptometre, zeptometres"},{"inches":"yoctometers","in, inch, inches":"ym, yoctometer, yoctometers, yoctometre, yoctometres"}]}
Examples
select wct.CONVERTLENGTH(.001, 'in', 'µm');
Here is the result set.
{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"25.4"}]}