This SQL Mathematical Function is used to calculate the power for the specified expression or numerical value, and its syntax is
SELECT POWER (Float_Expression, Value) FROM [Source]
SQL POWER Function Example
This math Function calculates the power of a given numeric value. The following query shows multiple ways to use it.
First, we declared a float variable, and we used it to calculate the power of the variable @i. It means, @i * @i * @i = 2 * 2 * 2 = 8. In the next SQL Server statement, we used 4 as the second argument. It means 2 * 2 * 2 * 2 = 16
We used the integer value as the Sql Server POWER function input within the first two SELECT statements. It means, (@j, 3) = @j * @j * @j => 2.20 * 2.20 * 2.20 = 10.65. But we are getting 8 as a result because it is rounding the 2.20 value to 2
DECLARE @i float = 2, @j int = 2.20 SELECT POWER(@i, 3) AS [SQLPowers] SELECT POWER(@i, 4) AS [SQLPowers] -- Calculating directly SELECT POWER(3.20, 3) AS [SQLPowers] -- Wrong Value SELECT POWER(@j, 3) AS [SQLPowers] SELECT POWER(2.20, 3) AS [SQLPower]

NOTE: Use float variables as this Math POWER Function input. Otherwise, you may expect strange results.
This function also allows you to calculate the power of column values. In this math function example, we are going to calculate the power of three for all records present in [Sales Amount]. For this demo, we use the data in the table below.
TIP: Please refer to the SQRT, SQUARE, and ABS functions from the available Mathematical Functions.
SELECT [EnglishProductName]
,[Color]
,[StandardCost]
,[SalesAmount]
,POWER([SalesAmount], 3) AS Sales
FROM [Mathemetical Functions]
