Moudiz
Moudiz

Reputation: 7377

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)

Upvotes: 0

Views: 115

Answers (2)

deepak
deepak

Reputation: 141

Use:

update #t set col1 = str_replace(col1, 'paris', 'turkey')

Upvotes: 0

Hip Hip Array
Hip Hip Array

Reputation: 4753

you can use the replace function for TSQL to do this

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

Upvotes: 2

Related Questions