SQRT (Transact-SQL)

Returns the positive square root of a positive number.

SQRT ( float_expression )

Parameters

float_expression

Is an expression of the float or integer data type. It can be a constant, a variable, or a column.

Return Value

Returns the positive square root of a positive number. The data type of the return value is float.

If the input expression is negative, SQRT returns NULL.

Remarks

Examples

Example 1: Calculating the square root of a positive number

SELECT SQRT(100.00);

Result:

10.00

Example 2: Calculating the square root of a negative number

SELECT SQRT(-50.00);

Result:

NULL

Example 3: Using SQRT with a table column

SELECT
    ProductID,
    ProductName,
    SQRT(Price) AS SquareRootOfPrice
FROM Products
WHERE Price > 0;

Applies to

See Also