Logo

SQL Server CUPS Function

Updated 2023-11-09 16:06:38.390000

Description

Use the scalar function CUPS 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 cups.

Syntax

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

column 1column 2
teaspoon0.020833333
tablespoon0.0625
fluid dram0.015625
fluid ounce0.125
cup1
pint2
quart4
gallon16
cubic inch0.069264069
cubic foot119.688312
cubic yard3231.58442
cubic mile1.76179E+13
imperial ounce0.120095042
imperial pint2.40190084
imperial quart4.80380169
imperial gallon19.2152068
barrel (beer)496
barrel (oil)672
bushel148.946848
gill0.5
imperial gill0.600475211
peck37.2367119
dry pint2.327294377
dry quart4.654588756
stere4226.75284
liter4.22675284
cubic meter4226.75284

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

Here is the result set.

column 1
4