SSIS Square of a Number

The SSIS SQUARE function is a mathematical function that returns the Square of a numeric expression or number. This article explains how to use the SQUARE function with an example and the syntax for finding the Square of a number is as shown below.


To demonstrate the SQUARE function, we use the Product table below, which has 14 records. Please refer to the Derived Column Transformation, Union All Transformation, Built-in Functions, and SQL Server articles in SSIS.

Source Table

SSIS Square of a Number

For this SQUARE function example, add a Data Flow Task and double-click on it to enter the Data Flow region. Next, add the OLE DB Source to read data from the above SQL database product table. Please join the OLE DB Source to Derived Column Transformation because it helps to write SQUARE expressions and create new columns.

Data Flow to add Derived Column

Next, double-click on it to open the Derived Column Transformation Editor. Drag and drop the SSIS SQUARE function to the row cell under the Expression and replace the numeric_expression with the Orders to find the square of the number. Either you can manually delete the complete numeric_expression or drag and drop the Orders column will automatically replace it.

The below SSIS SQUARE function expressions will calculate the square of a number in the orders, estimated, and grade columns.

SQUARE( [Orders] )

SQUARE( [Estimated] )

SQUARE( [Grade] )
SSIS Square of a Number Expression

Click OK to close the Editor window.

Drag and drop the Union All Transformation and connect the Derived Column to it. Next, right-click on the connection node and choose the Enable Data Viewer. Please run the SSIS SQUARE function package to see the Square of a number in the estimated, grade, and orders columns.

SSIS Square of a Number package