SQL Tutorial SQL Advanced SQL Database SQL References

SQL Server EXP() Function



The SQL Server (Transact-SQL) EXP() function returns e raised to the power of specified number, i.e., ex. Please note that e is the base of the natural system of logarithms, and its value is approximately 2.718282.

Syntax

EXP(x)

Parameters

x Required. Specify the exponent of e.

Return Value

Returns e raised to the power of specified number.

Example 1:

The example below shows the usage of EXP() function.

SELECT EXP(0);
Result: 1

SELECT EXP(1);
Result: 2.718281828459045

SELECT EXP(-1);
Result: 0.36787944117144233

SELECT EXP(2);
Result: 7.38905609893065

SELECT EXP(-2);
Result: 0.1353352832366127

SELECT LOG(EXP(1));
Result: 1

Example 2:

Consider a database table called Sample with the following records:

Datax
Data 1-2
Data 2-1
Data 30
Data 41
Data 52

The statement given below can be used to calculate the exponent of records of column x.

SELECT *, EXP(x) AS EXP_Value FROM Sample;

This will produce the result as shown below:

DataxEXP_Value
Data 1-20.1353352832366127
Data 2-10.36787944117144233
Data 301
Data 412.718281828459045
Data 527.38905609893065

❮ SQL Server Functions