Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Bradley Schacht

Bradley is a consultant at Pragmatic Works in Jacksonville, FL. He was an author on the book SharePoint 2010 Business Intelligence 24-Hour Trainer and tech edited the SQL 2011 Bible. His experience on the Microsoft BI platform includes DTS, SSIS, SSRS, SSAS and migrations and conversions. He has helped numerous companies in successfully developing and implementing new business intelligence solutions into their organizations. Bradley also participates as a speaker in community events like SQL Saturday, Code Camp, SQL Lunch and SQL Server User Groups. He is a contributor on sites such as BIDN.com and SQL Server Central as well as an active member of the Jacksonville SQL Server User Group (JSSUG).

Trim Functions in SSIS

In T-SQL there are many functions there to help do a variety of different things.  SSIS is no different.  In fact, a good number of the commonly used functions from T-SQL are in SSIS as well.  Here we will explore the different Trim functions found in SSIS.

We will be using the test phrase ”      Test      ” to illustrate the three functions: LTRIM, RTRIM and TRIM.

LTRIM (Left Trim):

Just as in T-SQL, this removed empty spaces from the beginning (or left) of a string.

Notice the highlighted result that the trailing spaces are still present but the leading spaces are gone.

RTRIM (Right Trim):
Just as in T-SQL, this removed empty spaces from the end (or right) of a string.

Notice the highlighted result that the trailing spaces are gone but the leading spaces are still present.

TRIM:
In T-SQL to remove both leading and training spaces you have to nest the trim statements like this: SELECT LTRIM(RTRIM(ColumnName)) AS ColumnName FROM Table. Luckily in SSIS there is a TRIM function that will remove both leading and trailing space in one function called TRIM.

Notice the highlighted result that the trailing and leading spaces are gone.

 

Comments

Leave a comment on the original post [www.bradleyschacht.com, opens in a new window]

Loading comments...