question

lddgnz avatar image
lddgnz asked

Update query to replace a character

Hi, I need some help from you all to prepare a query. Lets say, I have a Table "Account" with columns "AccountID" (unique) and "Name" along with some other columns. The Name column has some values with a comma ( , ) character in it (for e.g. Steven,Smith) which I now want to replace with a space. I can find all such entries containing a comma in Name with a select query, however want to know if there is any update query which I can use to replace this comma character with a space character.

TIA

query
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
malpashaa avatar image
malpashaa answered

Use this:

            
UPDATE Account            
   SET Name = REPLACE(Name, ',', ' ')            
 WHERE Name LIKE '%,%';             
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.