Arie
Arie

Reputation: 3563

Delete specific word at the beginning

in my table within some columns i got strings which starting always with /PicsDB

like this below:

/PicsDB/Something 2015/Some thing bla/Some thing other/img34234.jpg

what i want to achieve is to for each row delete starting string /PicsDB

so using above string the final result should be:

/Something 2015/Some thing bla/Some thing other/img34234.jpg

How to achieve that?

Can i just simply do ? :

UPDATE my_table SET path = replace(path, '/PicsDB', '');

Upvotes: 1

Views: 27

Answers (1)

James Z
James Z

Reputation: 12317

Just use substring:

UPDATE my_table SET path = substring(path, 8, 9999);
where path like '/PicsDB%'

Upvotes: 1

Related Questions