Logo

SQL Server CUYARDS Function

Updated 2023-11-09 16:07:29.567000

Description

Use the scalar function CUYARDS 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 cubic yards.

Syntax

SELECT [westclintech].[wct].[CUYARDS] (
  <@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 cubic yards:

column 1column 2
teaspoon6.44679E-06
tablespoon1.93404E-05
fluid dram4.83509E-06
fluid ounce3.86807E-05
cup0.000309446
pint0.000618891
quart0.001237783
gallon0.004951132
cubic inch2.14335E-05
cubic foot0.037037037
cubic yard1
cubic mile5451776000
imperial ounce3.71629E-05
imperial pint0.000743258
imperial quart0.001486516
imperial gallon0.005946064
barrel (beer)0.153485082
barrel (oil)0.207947531
bushel0.046090966
gill0.000154723
imperial gill0.000185814
peck0.011522742
dry pint0.000720171
dry quart0.001440343
stere1.30795062
liter0.001307951
cubic meter1.30795062

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

Here is the result set.

column 1
0.00123778292