The SSIS CEILING function is a mathematical function that returns the smallest integer value that is greater than or equal to the specified number or numeric expression. This article explains how to use the CEILING function with an example and the syntax for returning the nearest integer greater than or equal to the given value is as shown below.
CEILING(<<numeric_expression>>)
To demonstrate the CEILING function, we use the Product table below, which has 14 records. Please refer to the Derived Column Transformation, Union All Transformation, and Built-in Functions articles in SSIS.
SSIS CEILING function
For this CEILING example, let me 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 CEILING expressions and create new columns.
Next, double-click on it to open the Derived Column Transformation Editor. Drag and drop the SSIS CEILING function to the row cell under the Expression and replace the numeric_expression with the StandardCost column to return the small integer that is greater than or equals the existing one. Either you can manually delete the complete <<numeric_expression>> expression or drag and drop the StandardCost column will automatically replace it.
The below SSIS CEILING function expressions return the smallest integer value that is greater than or equal to the product standard cost, Sales Amount, and Tax amount. The last expression shows the performance of the CEILING function on negative values.
CEILING( [StandardCost] )
CEILING( [SalesAmount] )
CEILING( [TaxAmount] )
CEILING( [SalesAmount] - [StandardCost] )
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 CEILING function package to see the ceiling values of the standard cost, Sales amount, and tax amount columns.