Logo

SQL Server BARRELS Function

Updated 2023-11-09 15:28:31.340000

Description

Use the scalar function BARRELS 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 barrels.

Syntax

SELECT [westclintech].[wct].[BARRELS] (
  <@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 Type

float

Remarks

The following table is a representation of the conversion of one of the volume units of measure into barrels:

column 1column 2
teaspoon4.20027E-05
tablespoon0.000126008
fluid dram3.1502E-05
fluid ounce0.000252016
cup0.002016129
pint0.004032258
quart0.008064516
gallon0.032258065
cubic inch0.000139645
cubic foot0.24130708
cubic yard6.51529116
cubic mile35519908000
imperial ounce0.000242127
imperial pint0.004842542
imperial quart0.009685084
imperial gallon0.038740336
barrel (beer)1
barrel (oil)1.35483871
bushel0.300296064
gill0.001008065
imperial gill0.001210636
peck0.075074016
dry pint0.004692126
dry quart0.009384252
stere8.52167911
liter0.008521679
cubic meter8.52167911

Conversion of metric values (liters and cubic meters) includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.

Examples

select wct.BARRELS(1, 'quart');

Here is the result set.

column 1
0.00806451612903226