Returns the value of the given expression to the specified power.
POWER(numeric_expression, y)
Same as numeric_expression.
This example shows a floating point underflow that returns a result of 0.0.
SELECT POWER(2.0, -100.0)
GO
Here is the result set:
------------------------------------------
0.0
(1 row(s) affected)
This example returns POWER results for 21 to 24.
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
Here is the result set:
-----------
2
(1 row(s) affected)
-----------
4
(1 row(s) affected)
-----------
8
(1 row(s) affected)
-----------
16
(1 row(s) affected)
decimal and numeric | money and smallmoney |
float and real | Mathematical Functions |
int, smallint, and tinyint |