SSIS LEFT Function

The SSIS LEFT is a string function that returns the specified number of left part or leftmost characters from the string column or character expression. This article explains how to use the LEFT function with an example and the syntax for returning the left part of the character expression is as shown below.

LEFT(<<Character_expression>>, <<numbers>>)

Character_expression: Original String or the Column name.

Numbers: The total number of characters the LEFT fiction has to return from the left side.

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

Source Table

SSIS LEFT function

For this, 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 table. Please join the OLE DB Source to Derived Column Transformation because it helps to write LEFT function 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 LEFT function to the row cell under the Expression and replace the Character_expression with the string column name and numbers with an integer. Either you can manually delete the complete <Character_expression> expression or drag and drop the column will automatically replace it.

The below expression returns the leftmost six characters from the name field.

LEFT( [Name] , 6 )
SSIS LEFT Function Expression

The below expression uses the FINDSTRING function to return the location of the @ symbol. Next, the SSIS LEFT function returns the left part of the email address up to the @ symbol.

LEFT([Email Adress], FINDSTRING([Email Adress], "@", 1) - 1 )

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 LEFT function package to see the left part of the name and email address columns.

SSIS LEFT Function package output