Logo

SQL Server METERS Function

Updated 2023-11-09 14:11:00.553000

Description

Use the scalar function METERS to convert from fathoms, feet, furlongs, inches, meters, miles, nautical miles, pica, points or yards to meters.

Syntax

SELECT [westclintech].[wct].[METERS] (
  <@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 for @Length. @From_scale must be a valid value as specified in length unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.

@To_scale

is the description of the units for that @Length is to be converted into. @To_scale must be a valid value as specified in length unit representations. In addition to grams, @To_scale  can be decimeters, centimeters, millimeters, micrometers, nanometers, picometers, femtometers, attometers, zeptometers, yoctometers, decameters, hectometers, or kilometers .@To_scale must be of a data type that is implicitly convertible to varchar.

Return Type

float

Remarks

The following table is a representation of the conversion of one of the length units of measure into meters:

column 1column 2
inches0.02540
feet0.30480
yards0.91440
meters1.00000
fathoms1.82880
furlongs201.16800
miles1609.34400
nautical miles1852.00000
pica0.004233
points0.0003528

Conversion of meters includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.

Examples

select wct.METERS(100, 'yd', 'km');

Here is the result set.

column 1
0.09144