SQL Server EXP() Function
EXP() returns the exponential value of a float expression: the mathematical constant e (approximately 2.718281828) raised to that power. The input must be a float or a type SQL Server can implicitly convert to float, and the return type is float. See Microsoft’s EXP() reference.
Syntax
EXP(float_expression)
EXP(n) evaluates e to the power n; for example, EXP(1) returns approximately 2.71828182845905.
Examples
Here are two examples of using the SQL Server EXP() function:
Example 1
Calculate e squared:
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
Use EXP() to calculate e raised to an expression. For the inverse natural logarithm operation, see LOG().