The Kingdom Tech The Kingdom Tech - 1 year ago 84
SQL Question

Change one character in PostgreSQL column string

I have a hundreds of entries in a description column that look like the following:

CAP 0.001UF ±10% 50V X7R 0402

I need to change it to:

CAP 0.001UF +/-10% 50V X7R 040

How can I search through the records and change all instances of

Answer Source

How about using replace() and like?

update t
    set description = replace(description, '±', '+/-')
    where description like '%±%';
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download