Logo

SQL Server CONVERTTEMP Function

Updated 2024-02-13 19:18:57.390000

Description

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

Syntax

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

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:

CelsiusC
KelvinK
FahrenheitF
RankineR

Examples

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

Here is the result set.

column 1
212