Returns the value of the specified expression to the specified power.
Transact-SQL Syntax Conventions
POWER ( float_expression , y )
Is an expression of type float or of a type that can be implicitly converted to float.
Is the power to which to raise float_expression. y can be an expression of the exact numeric or approximate numeric data type category, except for the bit data type.
Same as float_expression.
The following example shows a floating point underflow that returns a result of 0.0.
0.0
SELECT POWER(2.0, -100.0) GO
Here is the result set.
------------------------------------------ 0.0 (1 row(s) affected)
The following example returns POWER results for 2.
POWER
2
DECLARE @value int, @counter int SET @value = 2 SET @counter = 1 WHILE @counter < 5 BEGIN SELECT POWER(@value, @counter) SET NOCOUNT ON SET @counter = @counter + 1 SET NOCOUNT OFF END GO
----------- 2 (1 row(s) affected) ----------- 4 (1 row(s) affected) ----------- 8 (1 row(s) affected) ----------- 16 (1 row(s) affected)
14 April 2006