2

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?

Dale K
  • 25,246
  • 15
  • 42
  • 71
the606
  • 51
  • 5
  • Uueerdo is certainly correct. However, simply removing the characters could concatenate words. Take a peek at https://stackoverflow.com/questions/43148767/sql-server-remove-all-non-printable-ascii-characters/43149139#43149139 – John Cappelletti Mar 16 '20 at 18:31

1 Answers1

5

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), '')

Uueerdo
  • 15,723
  • 1
  • 16
  • 21