Logo

SQL Server QUARTS Function

Updated 2023-11-09 16:28:07.120000

Description

Use the scalar function QUARTS 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 quarts.

Syntax

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

column 1column 2
teaspoon0.005208333
tablespoon0.015625
fluid dram0.00390625
fluid ounce0.03125
cup0.25
pint0.5
quart1
gallon4
cubic inch0.017316017
cubic foot29.9220779
cubic yard807.896104
cubic mile4.40447E+12
imperial ounce0.030023761
imperial pint0.600475211
imperial quart1.20095042
imperial gallon4.80380169
barrel (beer)124
barrel (oil)168
bushel37.2367119
gill0.125
imperial gill0.150118803
peck9.30917797
dry pint0.581823594
dry quart1.163647189
stere1056.68821
liter1.05668821
cubic meter1056.68821

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

Here is the result set.

column 1
1