Search code examples
oracle-databaset-sqlsap-ase

update a specific word in column


I have this column

column
London/paris
toronto/paris
Tokyo/paris

I want to update only the word 'paris'

My desirable result:

column
London/turkey
toronto/turkey
Tokyo/turkey

Can I have a condition like if next to paris is toronto I update it to berlin?

EDIT.
I want to know the queries in oracle or sybase. (I am not sure if I can ask this question separated in ora and syb, I hope a moderator give me an advice about that)


Solution

  • you can use the replace function for TSQL to do this

    UPDATE myTable
    SET MyColumn = REPLACE(MyColumn, 'paris', 'turkey')
    WHERE MyColumn LIKE '%paris%'