Logo

SQL Server DRAMS Function

Updated 2023-11-09 19:03:45.510000

Description

Use the scalar function DRAMS to convert from drams, grains, grams, hundredweights, ounces, pennyweights, pounds, stones, tonnes, tons, troy pounds or troy ounces to drams.

Syntax

SELECT [westclintech].[wct].[DRAMS] (
  <@Weight, float,>
 ,<@From_scale, nvarchar(4000),>)

Arguments

@Weight

is any real number. @Weight 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 @Weight. @From_scale must be a valid value as specified in weight 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 weight units of measure into drams:

column 1column 2
grains0.0365714286
drams1
ounces avoirdupois16
pounds avoirdupois256
stones3584
hundredweights25600
tons512000
pennyweights0.877714286
ounces troy17.5542857
pounds troy210.6514284
grams0.564383391
tonnes564383.391

Conversion of grams includes all the standard prefixes with kilo representing 1,000 and yocto representing 10E-24.

Examples

select wct.DRAMS(100, 'lbs');

Here is the result set.

column 1
25600