27

I'm trying to remove a non-breaking space (CHAR 160) from a field in my table. I've tried using functions like RTRIM() to get rid of it, but the value is still there.

What do I need to do to remove the non-breaking space from the column?

AHiggins
  • 6,919
  • 6
  • 35
  • 53
paparazzo
  • 43,659
  • 20
  • 99
  • 164

3 Answers3

57

Try using REPLACE

UPDATE Your_Table
SET Your_Column = REPLACE(Your_Column, NCHAR(0x00A0), '')
WHERE Id = x
Brian Rogers
  • 118,414
  • 30
  • 277
  • 278
18

You could also use

REPLACE(The_txt, NCHAR(160), ' ')
Robert Levy
  • 28,401
  • 6
  • 60
  • 93
Totor777
  • 181
  • 1
  • 3
5

If the above solutions does not work, try CHAR instead of NCHAR

UPDATE Your_Table
SET Your_Column = REPLACE(Your_Column, CHAR(160), '')
WHERE Id = x

CHAR worked for me.

Mallikarjun M
  • 1,487
  • 1
  • 17
  • 17