Math Functions – POWER()

I am going to remain on course with my series of short articles or tidbits on Transaction SQL math functions. Most, if not all, of these functions have been in the product before the release of SQL Server 2005.

I am very proud of my daughter making the advance math class in sixth grade. I am dedicating these blogs to her hard class work and love of the subject.

I will be exploring the POWER() function today. This function takes two expressions, a base B and a exponent/power N, as input in either exact numeric or approximate numeric form. This does not include the BIT data type. If N is positive integer, the output of the function is the result of multiplying B times itself for a total of N times.

There is a huge area of mathematics study called exponentiation. We will talk about other types of exponents in the future.

The example below tests the POWER() function with five different pairs of inputs: exact numbers, approximate numbers, null base, null exponent, and null values for both arguments.

The output from the test is listed below.

In short, the POWER() function if a fine replace of the SQUARE() function if the exponent N, is the number 2.

Related posts

Leave a Comment