What is the SQUARE() function in SQL Server?

The SQUARE() function finds the square of a given number. For example, if a number passed in the function is 5, it will return 25.

Note: This function accepts both negative and positive numbers. Moreover, the function also accepts fractions. The function will always return a positive value.

Syntax

SQUARE(number)

Parameter

**`number`**: This is the number whose square will be returned.

Example

This example takes a positive number in the function. The function returns the number's square.
SELECT SQUARE(10);

Output

100.0

Example

This example takes a negative number in the function. The function returns the number's square.
SELECT SQUARE(-3);

Output

9.0

Free Resources