Login     Register

        Contact Us     Search

XLeratorDB/engineering Online Documentation

SQL Server function to convert weight to tons


TON
 
Updated: 01 December 2008 

Use TON to convert from drams, grains, grams, hundredweights, ounces, pennyweights, pounds, stones, tonnes, tons, troy pounds, or troy ounces to tons.
Syntax
SELECT [westclintech].[wct].[TON] (
  <@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 Types
float
Remarks
·         The following table is a representation of the conversion of one of the weight units of measure into tons:
grains
0.000000071429
drams
1.95313E-06
ounces avoirdupois
0.00003125
pounds avoirdupois
0.0005
stones
0.007
hundredweights
0.05
tons
1
pennyweights
1.71429E-06
ounces troy
3.42857E-05
pounds troy
0.0004114
grams
0.00000110231131
tonnes
1.10231131
 
·         Conversion of grams includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.
Example
 
select wct.TON(100, 'lbs')
Here is the result set
----------------------
0.05
 
(1 row(s) affected)


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service