square

Description

Calculates the square of a specified value expressed as a float.

Syntax

square(numeric_expression)

Parameters

numeric_expression

is a numeric expression of type float.

Examples

Example 1

Returns the square from an integer column:

select square(total_sales)from titles
------------
16769025.00000
15023376.00000
350513284.00000
...
16769025.00000
(18 row(s) affected)

Example 2

Returns the square from a money column:

select square(price) from titles
-----------
399.600100
142.802500
8.940100
NULL
...
224.700100
(18 row(s) affected)

Usage

This function is the equivalent of power(numeric_expression,2), but it returns type float rather than int.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute square.

See also

Function power

Datatypes exact_numeric, approximate_numeric, money, float