SQL Server TROY Function
Updated 2023-11-09 19:16:14.817000
Description
Use the scalar function TROY to convert from drams, grains, grams, hundredweights, ounces, pennyweights, pounds, stones, tonnes, tons, troy pounds or troy ounces to troy ounces.
Syntax
SELECT [westclintech].[wct].[TROY] (
<@Weight, float,>
,<@From_scale, nvarchar(4000),>)
Arguments
@Weight
is any real number. @Weight 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 @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 troy ounces:
| column 1 | column 2 |
|---|---|
| grains | 0.00208333333 |
| drams | 0.0569661458 |
| ounces avoirdupois | 0.911458333 |
| pounds avoirdupois | 14.5833333 |
| stones | 204.1666662 |
| hundredweights | 1458.33333 |
| tons | 29166.6666 |
| pennyweights | 0.05 |
| ounces troy | 1 |
| pounds troy | 12.0000000 |
| grams | 0.0321507466 |
| tonnes | 32150.7466 |
Conversion of grams includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.
Examples
select wct.TROY(100, 'lbs');
Here is the result set.
| column 1 |
|---|
| 1458.33333 |