views:

60

answers:

3

I have column with values that have wrong character ?. Now I want to change it to character b. For this I am using this statement:

SELECT REPLACE(name,'?','b') from contacts;

But when I do this nothing's happening, it return value with ?.

What I am doing wrong? How I can replace this?

A: 

Try this

update contacts set name=replace(name, '?', 'b')
shoebox639
+3  A: 

Are you actually trying to change the values in the table? In that case, you'll need to do an UPDATE:

UPDATE contacts
SET name = Replace(name,'?','b')

Otherwise, if you are simply trying to retrieve a modified value, your syntax should work just fine. (I tested it, ? doesn't have to be escaped or anything):

SELECT name, Replace(name,'?','b') as Fixed
FROM contacts
BradC
+3  A: 

Another possibility that I've seen before is that the character looks like a regular old ASCII question mark but it's not really. It's actually a different character. I'd select the text and paste it into Notepad and then copy and paste it into my query.

Russell McClure
That is most likely what it is. I have seen something similar to that in Oracle.
scarpacci