Share via


POWER (SQL Server Compact)

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

Syntax

POWER ( numeric_expression, y)

Arguments

  • 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.

Return Value

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

Example

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