SQL Server POWER() Function

The POWER() function in SQL Server calculates the result of raising a number to a specified power (exponent). This is a fundamental mathematical operation used in various calculations.



POWER(): Definition and Usage

POWER() takes two numeric arguments: the base number and the exponent. It returns the base number raised to the power of the exponent (baseexponent). This function is useful for a wide range of mathematical computations and data manipulations.

Syntax

Syntax

POWER(a, b)
      

Parameter Values

Parameter Description
a The base number (the number being raised to a power). This is required.
b The exponent (the power). This is required.

Examples

Raising a Number to a Power

This example calculates 4 raised to the power of 2 (42 = 4 * 4 = 16).

Syntax

SELECT POWER(4, 2);
      
Output

16
      

Raising Another Number to a Power

This example calculates 8 raised to the power of 3 (83 = 8 * 8 * 8 = 512).

Syntax

SELECT POWER(8, 3);
      
Output

512