Logo

SQL Server CONVERTVOLUME Function

Updated 2023-11-09 16:01:13.553000

Description

Convert to and 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.

Syntax

SELECT [westclintech].[wct].[CONVERTVOLUME] (
   <@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 @Volume is being converted from. @From_scale must be a valid value as specified in area unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.

@To_scale

is the description of the units @Volume is being converted to. @From_scale must be a valid value as specified in area unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.

Return Type

float

Remarks

Volume unit representations:

unitabbrev
teaspoonstsp, tsps, teaspoon, teaspoons
tablespoonstbsp, tbsps, tablespoon, tablespoons
fluid dramsfl dr, fldr, fluid dram, fluid drams
fluid ouncesfl oz, floz, fl ozs, flozs, fluid ounce, fluid ounces
cupscup, cups
pintspint, pints
quartsqt, qts, quart, quarts
gallonsgal, gals, gallon, gallons
cubic inchesin^3, cu in, cu ins, cubic inch, cubic inches
cubic feetft^3, cu ft, cubic foot, cubic feet
cubic yardsyd^3, cu yd, cu yds, cubic yard, cubic yards
cubic milesmi^3, cu mi, cu mis, cubic mile, cubic miles
imperial ouncesimp oz, impoz, imp ozs, impozs, imperial ounce, imperial ounces
imperial pintsimp pt, imppt, imp pts, imppts, imperial pint, imperial pints
imperial quartsimp qt, impqt, imp qts, impqts, imperial quart, imperial quarts
imperial gallonsimp gal, impgal, imp gals, impgals, imperial gallon, imperial gallons
barrels (US beer barrels)barrel, barrels
barrels (oil barrels)bbl, bbls
bushelsbu, bus, bushel, bushels
gillsgi, gill, gills
imperial gillsimp gi, imperial gill, imperial gills
peckspk, peck, pecks
dry pintsdry pt, dry pint, dry pints
dry quartsdry qt, dry quart, dry quarts
steresst, stere, steres
litersl, liter, liters
decilitersdl, deciliter, deciliters
centiliterscl, centiliter, centiliters
millilitersml, milliliter, milliliters
microlitersµl, microliter, microliters
nanolitersnl,nanoliter, nanoliters
picoliterspl, picoliter, picoliters
femtolitersfl, femtoliter, femtoliters
attolitersal, attoliter, attoliters
zeptoliterszl, zeptoliter, zeptoliters
yoctolitersyl, yoctoliter, yoctoliters
decalitersdal, decaliter, decaliters
hectolitershl, hectoliter, hectoliters
kiloliterskl, kiloliter, kiloliters liters
cubic metersm^3, cu m, cu ms, cubic meter, cubic meters, cubic metre, cubic metres
cubic decimeterdm^3, cu dm, cu dms, cubic decimeter, cubic decimeters, cubic decimetre, cubic decimetres
cubic centimetercm^3, cu cm, cu cms, cubic centimeter, cubic centimeters, cubic centimetre, cubic centimetres
cubic millimetermm^3, cu mm, cu mms, cubic millimeter, cubic millimeters, cubic millimetre, cubic millimetres
cubic micronsµm^3, cu µm, cu µms, cubic micron, cubic microns
cubic nanometersnm^3, cu nm, cu nms, cubic nanometer, cubic nanometers, cubic nanometre, cubic nanometres
cubic picometerspm^3, cu pm, cu pms, cubic picometer, cubic picometers, cubic picometre, cubic picometres
cubic femtometersfm^3, cu fm, cu fms, cubic femtometer, cubic femtometers, cubic femtometre, cubic femtometres
cubic attometersam^3, cu am, cu ams, cubic attometer, cubic attometers, cubic attometre, cubic attometres

Examples

select wct.CONVERTVOLUME(100, 'l', 'gals');

Here is the result set.

----------------------
            26.4172052