SQL Server TONNES Function
Updated 2023-11-09 19:13:46.287000
Description
Use the scalar function TONNES to convert from drams, grains, grams, hundredweights, ounces, pennyweights, pounds, stones, tonnes, tons, troy pounds or troy ounces to tonnes.
Syntax
SELECT [westclintech].[wct].[TONNES] (
<@weight, float,>
,<@From_scale, nvarchar(4000),>)
Arguments
@From_scale
is the description of the units for @Weight. @From_scale must be a valid value as specified in weight unit representations. @From_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 weight units of measure into tonnes:
| column 1 | column 2 |
|---|---|
| grains | 0.00000006480000 |
| drams | 0.00000177184520 |
| ounces avoirdupois | 0.00002834952000 |
| pounds avoirdupois | 0.00045359237000 |
| stones | 0.006350293 |
| hundredweights | 0.04535923700000 |
| tons | 0.90718474000000 |
| pennyweights | 0.00000155517384 |
| ounces troy | 0.00003110347680 |
| pounds troy | 0.00037324172160 |
| grams | 0.00000100000000 |
| tonnes | 1.00000000000000 |
Conversion of grams includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.
Examples
select wct.TONNES(100, 'lbs');
Here is the result set.
----------------------
0.045359237