TRIM (SSIS Expression)
Applies To: SQL Server 2016
Returns a character expression after removing leading and trailing spaces.
Is a character expression from which to remove spaces.
TRIM returns a null result if the argument is null.
TRIM works only with the DT_WSTR data type. A character_expression argument that is a string literal or a data column with the DT_STR data type is implicitly cast to the DT_WSTR data type before TRIM performs its operation. Other data types must be explicitly cast to the DT_WSTR data type. For more information, see Integration Services Data Types and Cast (SSIS Expression).
This example removes leading and trailing spaces from a string literal. The return result is "New York".
TRIM(" New York ")
This example removes leading and trailing spaces from the result of concatenating the FirstName and LastName columns. The empty string between FirstName and LastName is not removed.
TRIM(FirstName + " "+ LastName)