SSIS LN Function

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

LN(<<numeric_expression>>)

To demonstrate the LN 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 LN function

For this natural logarithmic value example, add a Data Flow Task and double-click 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 LN 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 LN function to the row cell under the Expression and replace the numeric_expression with the Estimated, Orders, and Sales amount to find the natural logarithmic values. Either you can manually delete the complete <<numeric_expression>> expression or drag and drop the Estimated column will automatically replace it.

The below SSIS LN function expressions return the natural logarithmic values of the Estimated, Orders, and Sales amount columns.

LN( [Estimated] )
LN( [Orders] )
LN( [SalesAmount] )
SSIS LN Function expression to find natural logarithmic value

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 LN function package to see the natural logarithmic values of the Orders, Estimated, and sales columns.

SSIS LN Function to find natural logarithmic value