Export (0) Print
Expand All
Expand Minimize

POWER (SQL Server Compact)

Returns the value of the given expression to the specified power.


POWER ( numeric_expression, y)

numeric_expression

An expression of the exact numeric or approximate numeric data type categories, or types that are implicitly convertible to float.

y

The power to raise numeric_expression to. The y argument can be an expression of types that are implicitly convertible to float.

Returns the same type as numeric_expression except for the following expressions.

Specified expression

Return type

tinyint , smallint

int

real /float

float

Nonnumeric types that can be implicitly converted to float

float

The following example raises the values in the SourceValues column of the Values table to the power of 3.

SELECT SourceValues, POWER(SourceValues, 3) AS Cube
FROM Values
ORDER BY SourceValues

This is the result set:

SourceValues.....................Cube
--------------------------------
1................................1
2................................8
3................................27
4................................64
5................................125
6................................216
7................................314
8................................512
9................................729
Show:
© 2014 Microsoft