SQL Server EXP() Function

Summary: in this tutorial, you will learn how to use the SQL Server EXP() function to calculate the exponential value of a number.

Introduction to SQL Server EXP() function

The EXP() function is a math function that allows you to calculate the exponential value of a specified number.

Here’s the syntax for the EXP() function:

EXP(n)Code language: SQL (Structured Query Language) (sql)

In this syntax:

  • The n is a float or a value that can implicitly converted to a float.

The EXP() function returns en where e is approximately equal to 2.71828182845905. If n is NULL, then the EXP() function returns NULL.

SQL Server EXP() function examples

Let’s take some examples of using the EXP() function.

1) Basic EXP() function examples

The following example uses the EXP() function to find the exponential value of 1:

SELECT EXP(1) result;Code language: SQL (Structured Query Language) (sql)

Output:

result
----------------
2.71828182845905

(1 row affected)Code language: SQL (Structured Query Language) (sql)

The following statement uses the EXP() function to calculate the exponential value of 5:

SELECT EXP(5) result;Code language: SQL (Structured Query Language) (sql)

Output:

result
-----------------
148.413159102577Code language: SQL (Structured Query Language) (sql)

Summary

  • Use the EXP() function to calculate the exponential value of a number.
Was this tutorial helpful?