Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Removing a pesky hidden character from a string Expand / Collapse
Author
Message
Posted Friday, November 30, 2007 8:40 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 292, Visits: 775
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.


  Post Attachments 
GoAwayPeskyChar.jpeg (27 views, 13.52 KB)
Post #428147
Posted Friday, November 30, 2007 8:52 AM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 292, Visits: 775
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.
Post #428155
Posted Friday, December 21, 2012 3:38 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 21, 2012 4:10 PM
Points: 1, Visits: 3
THANKS THAT WAS JUST WHAT I NEEDED!
Post #1399619
Posted Friday, December 21, 2012 4:06 PM


SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Today @ 6:23 AM
Points: 292, Visits: 775
victorjcook (12/21/2012)
THANKS THAT WAS JUST WHAT I NEEDED!


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

- SD
Post #1399624
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse