Replacing Special Characters in a select statement

Viewed 88

I'm trying to write a select statement and in some of the text is a LF or tab, I have tried the following

select id, quantity, REPLACE(example.Description,CHAR(13)+CHAR(10)+CHAR(9) ,' ') AS 'Detail'
from table 

But the special characters are still there when I paste into Excel or export.

Any ideas please?

Also how do you see what the actual character is?

1 Answers

REPLACE doesn't take a list of values, it takes a string. You're trying to replace any instances of a substring with that exact sequence of special characters.

To replace multiple characters individually you need something like REPLACE(REPLACE(REPLACE(example.Description, CHAR(13), ''), CHAR(10), ''), CHAR(9), '')

Related