SQL Server EXP() Function

The SQL Server EXP() function returns the value of the mathematical constant e raised to a specified power, which is the exponential value of a given number.

Syntax

EXP(n)

Parameter: n is the exponent value, which can be any number.

Return Value: The function returns e raised to the power of n.

Usage

The SQL Server EXP() function is commonly used to calculate exponential values.

Examples

Here are two examples of using the SQL Server EXP() function:

Example 1

Calculate the square of e:

SELECT EXP(2) as Result;

Result:

Result
7.389056

Explanation: The function returns the value of e raised to the power of 2, which is approximately 7.389056.

Example 2

Calculate the exponential value of e with different exponents:

SELECT EXP(1) as Result1, EXP(2) as Result2, EXP(3) as Result3;

Result:

Result1 Result2 Result3
2.718282 7.389056 20.08554

Explanation: The function returns the value of e raised to the power of 1, 2, and 3, respectively.

Conclusion

The SQL Server EXP() function returns the exponential value of a given number with respect to e. It can be used to calculate exponential values.