paparazzo
paparazzo

Reputation: 45096

How do I remove non-breaking spaces from a column in SQL server?

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?

Upvotes: 33

Views: 54676

Answers (4)

David Lipschitz
David Lipschitz

Reputation: 152

NCHR(160) worked for me.

Oracle 19c.

Upvotes: 1

arjun
arjun

Reputation: 1203

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.

Upvotes: 7

Totor777
Totor777

Reputation: 321

You could also use

REPLACE(The_txt, NCHAR(160), ' ')

Upvotes: 22

Brian Rogers
Brian Rogers

Reputation: 129697

Try using REPLACE

UPDATE Your_Table
SET Your_Column = REPLACE(Your_Column, NCHAR(0x00A0), '')
WHERE Id = x

Upvotes: 62

Related Questions