Link to home
Start Free TrialLog in
Avatar of mpdillon
mpdillon

asked on

Unexpected Replace results

Using the following UPDATE statement, I do not get the results I expect.
 
Update WSWebProductName set ProductNameTextHtml = Replace(ProductNameTextHtml,'%'+Char(153)+'%','™') where IDNo = 382

Open in new window


In the field ProductNametextHTML there are trademarks which I can find using the where clause:
Where ProductNameTextHtml like '%' + Char(153) + '%'

I am trying to replace the Char(153) with the HTML text ™. When I run the query in Visual Basic or in SSMS, I am notifield one record is updated. But when I view the record in SSMS the TM is still there and not the ™. When I run the query again, I get feed back that one record was affected.
The Field ProductNametextHTML is a varchar(50) field.

Why is the REPLACE not working? What is the correct way to accomplish the replacement?
thanks,
pat
ASKER CERTIFIED SOLUTION
Avatar of knightEknight
knightEknight
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mpdillon
mpdillon

ASKER

knightEknight,
Thanks. That was it.
I was using 382 as an example but there are hunreds of there records that need replacing.

pat
I'm not sure why I thought it was necessary to identify specific rows.  The update will work just fine for the whole table.  :)