Login     Register

        Contact Us     Search

XLeratorDB/engineering Online Documentation

SQL Server function to convert volume to imperial gallons


IMPGALLONS
 
Updated: 01 December 2008 

Use IMPGALLONS 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 imperial gallons.
Syntax
SELECT [westclintech].[wct].[IMPGALLONS] (
  <@Volume, float,>
 ,<@From_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.
 
Return Types
float
Remarks
·         The following table is a representation of the conversion of one of the volume units of measure into imperial gallons:
teaspoon
0.001084
tablespoon
0.003253
fluid dram
0.000813
fluid ounce
0.006505
cup
0.052042
pint
0.104084
quart
0.208168
gallon
0.832674
cubic inch
0.003605
cubic foot
6.228833
cubic yard
168.1785
cubic mile
9.17E+11
imperial ounce
0.00625
imperial pint
0.125
imperial quart
0.25
imperial gallon
1
barrel (beer)
25.81289
barrel (oil)
34.9723
bushel
7.751509
gill
0.026021
imperial gill
0.03125
peck
1.937877
dry pint
0.121117
dry quart
0.242235
stere
219.9692
liter
0.219969
cubic meter
219.9692
 
·         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.IMPGALLONS(1, 'quart')
Here is the result set
----------------------
0.20816846
 
(1 row(s) affected)


Copyright 2008-2017 Westclintech LLC         Privacy Policy        Terms of Service