Logo

SQL Server PECKS Function

Updated 2023-11-09 16:26:29.637000

Description

Use the scalar function PECKS 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 pecks.

Syntax

SELECT [westclintech].[wct].[PECKS] (
  <@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 pecks:

column 1column 2
teaspoon0.000559484
tablespoon0.001678451
fluid dram0.000419613
fluid ounce0.003356902
cup0.026855218
pint0.053710435
quart0.10742087
gallon0.429683481
cubic inch0.001860102
cubic foot3.21425565
cubic yard86.7849026
cubic mile4.73132E+11
imperial ounce0.003225178
imperial pint0.06450357
imperial quart0.12900714
imperial gallon0.516028558
barrel (beer)13.3201879
barrel (oil)18.04670619
bushel4
gill0.013427615
imperial gill0.016125892
peck1
dry pint0.0625
dry quart0.125
stere113.510367
liter0.113510367
cubic meter113.510367

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.PECKS(1, 'quart');

Here is the result set.

column 1
0.10742087