Logo

CONVERTTEMP

Updated 2024-02-13 19:18:57.390000

Syntax

SELECT [westclintech].[wct].[CONVERTTEMP] (
  <@Temperature, float,>
 ,<@From_scale, nvarchar(4000),>
 ,<@To_scale, nvarchar(4000),>)

Description

Use the scalar function CONVERTTEMP to convert to and from Celsius, Fahrenheit, Kelvin or Rankine.

Arguments

@Temperature

is any real number. @Temperature 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 @Temperature is being converted from. @From_scale must be a valid value as specified in area unit representations. @From_scale must be of a data type that is implicitly convertible to varchar.

@To_scale

is the description of the units @Temperature is being converted to. @To_scale must be a valid value as specified in area unit representations. @To_scale must be of a data type that is implicitly convertible to varchar.

Return Type

float

Remarks

Temperature unit representations:

{"columns":[{"field":"Celsius","width":319},{"field":"C","width":319}],"rows":[{"Celsius":"Kelvin","C":"K"},{"Celsius":"Fahrenheit","C":"F"},{"Celsius":"Rankine","C":"R"}]}

Examples

select wct.CONVERTTEMP(100, 'C', 'F');

Here is the result set.

{"columns":[{"field":"column 1","headerClass":"ag-right-aligned-header","cellClass":"ag-right-aligned-cell"}],"rows":[{"column 1":"212"}]}