Login     Register

        Contact Us     Search

XLeratorDB/engineering Online Documentation

SQL Server function to convert volume to liters


LITERS
 
Updated: 01 December 2008 

Use LITERS to convert from barrels (US beer barrels), bbl (oil barrel), bushels, cubic feet, cubic inches, cubic meters, cubic miles, cubic yards, cups, dry pints, dry quarts, fluid drams, fluid ounces, gallons, gills, imperial gallons, imperial gills, imperial pints, imperial quarts, liters, pecks, pints, quarts, steres, tablespoons, or teaspoons to liters.
Syntax
SELECT [westclintech].[wct].[LITERS] (
  <@Volume, float,>
 ,<@From_scale, nvarchar(4000),>
 ,<@To_scale, nvarchar(4000),>)
Arguments
@Volume
is any real number. @Volume 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 @Volume. @From_scale must be a valid value as specified in volume 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 @Volume is to be converted into. @To_scale must be a valid value as specified in volume unit representations. In addition to liters, @To_scale  can be deciliters, centiliters, milliliters, microliters, nanoliters, picoliters, femtoliters, attoliters, zeptoliters, yoctoliters, decaliters, hectoliters, or kiloliters .@To_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 volume units of measure into liters:
teaspoon
0.004928922
tablespoon
0.01478676
fluid dram
0.003696691
fluid ounce
0.02957353
cup
0.2365882
pint
0.4731765
quart
0.9463529
gallon
3.785412
cubic inch
0.01638706
cubic foot
28.31685
cubic yard
764.5549
cubic mile
4.16818E+12
imperial ounce
0.02841306
imperial pint
0.568261485
imperial quart
1.13652297
imperial gallon
4.54609188
barrel (beer)
117.347772
barrel (oil)
158.987304
bushel
35.23907
gill
0.1182941
imperial gill
0.1420653
peck
8.809768
dry pint
0.5506105
dry quart
1.101221
stere
1000
liter
1
cubic meter
1000
 
·         Conversion of metric values (liters and cubic meters) includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.
Example
 
select wct.LITERS(1, 'quart', 'liters')
Here is the result set
----------------------
0.9463529
 
(1 row(s) affected)


Copyright 2008-2024 Westclintech LLC         Privacy Policy        Terms of Service