0

I have a data extension with a column titled 'Email Name'. My reporting I have it pipe (|) delimited into a .txt file. When the 'Email Name' column comes in, some values have spaces in the front for example: Wow - this email is awesome|.

I'm want to remove the space at the front of the Email Name for every value in the 'Email Name' column. The spaces always come after the | but before the name. Is there a way to do that utilizing the REPLACE function? Below is what I have, but it doesn't seem to be working.

Select  [Email Name], 
REPLACE([Email Name], '%Wow', 'Wow%')
as 'Wow%' 
From Data_Extension_Name

1 Answer 1

4

Can likely use the TRIM(), LTRIM() or RTRIM() functions.

I vaguely remember that the more general TRIM() does not work in SFMC, so in this case you would want to use LTRIM().

For example, say you have the following data:

col
--------
 Name 1
Name 2
Name 3

you would then use the following SQL to remove that space from Name 1:

SELECT LTRIM(col) AS Name
FROM myDE

Which will return:

Name
--------
Name 1
Name 2
Name 3

To also remove trailing spaces, you can combine it to:

SELECT RTRIM(LTRIM(col)) AS Name
FROM myDE

This of course would be easier to be done by using TRIM() which does both, but as I stated, I do not believe it works in SFMC.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .