sql - Replace all occurrences of a substring in a database text field -


i have database has around 10k records , of them contain html characters replace.

for example can find occurrences:

select * table textfield '%&#47%' 

the original string example:

this cool mega string contains &#47

how replace &#47 / ?

the end result should be:

this cool mega string contains /

if want replace specific string string or transformation of string, use "replace" function in postgresql. instance, replace occurances of "cat" "dog" in column "myfield", do:

update tablename set myfield = replace(myfield,"cat", "dog") 

you add clause or other logic see fit.

alternatively, if trying convert html entities, ascii characters, or between various encoding schemes, postgre has functions well. postgresql string functions.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -