SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Removing a pesky hidden character from a string


Removing a pesky hidden character from a string

Author
Message
Simon E Doubt
Simon E Doubt
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1051 Visits: 895
Hello All:

I am trying to remove a pesky hidden character from a string.

The hidden character looks like a blank space, but when I copy/paste it into MsWord, and use the Show Paragraph/Formatting Marks option, the symbol it reveals looks something like the DEGREE symbol, i.e. a small circle. I've attached (I hope) a JPEG screencap of the symbol. It appears at the end of the sentence, between the period and the paragraph mark.

I have tried using the following UPDATE code to get rid of it, where tblWeirdChar houses the string with the pesky char:

UPDATE dbo.tblWeirdChar
SET MyString = REPLACE(MyString,' ','')

But that didn't work; I guess SQL Server knows that it's not a blank space.

I also tried RTRIM, but that didn't work either.

Can anyone advise?

Thanks,
Simon Doubt
DBA, Fulcrum Publications, Inc.
Attachments
GoAwayPeskyChar.jpeg (108 views, 13.00 KB)
Simon E Doubt
Simon E Doubt
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1051 Visits: 895
Just figured it out:

I used:

SELECT ASCII(RIGHT(MyString,1))
FROM dbo.tblWeirdChar

and the ASCII code was 160, which is a non-breaking space.

So, I used:

UPDATE dbo.tblWeirdChar
SET MyString = REPLACE(MyString,CHAR(160),'')

And it worked!

Sorry for the self-posting.
-Simon Doubt
DBA, Fulcrum Publications, Inc.
victorjcook
victorjcook
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 3
THANKS THAT WAS JUST WHAT I NEEDED!
Simon E Doubt
Simon E Doubt
Ten Centuries
Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)Ten Centuries (1.1K reputation)

Group: General Forum Members
Points: 1051 Visits: 895
victorjcook (12/21/2012)
THANKS THAT WAS JUST WHAT I NEEDED!


Smile
Great - glad it was of some use.
Happy Holidays!

- SD
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search