Logo

SQL Server PINTS Function

Updated 2023-11-09 16:27:20.267000

Description

Use the scalar function PINTS 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 pints.

Syntax

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

column 1column 2
teaspoon0.010416667
tablespoon0.03125
fluid dram0.0078125
fluid ounce0.0625
cup0.5
pint1
quart2
gallon8
cubic inch0.034632035
cubic foot59.8441558
cubic yard1615.79221
cubic mile8.80894E+12
imperial ounce0.060047521
imperial pint1.20095042
imperial quart2.40190084
imperial gallon9.60760338
barrel (beer)248
barrel (oil)336
bushel74.4734238
gill0.25
imperial gill0.300237605
peck18.6183559
dry pint1.163647189
dry quart2.327294378
stere2113.37642
liter2.11337642
cubic meter2113.37642

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

Here is the result set.

column 1
2