Friday, 15 April 2011

SQLite: replace part of a string with another one -



SQLite: replace part of a string with another one -

i have column named "tel". column has records start (for example) "0511" , want alter "0513". proper query?

you can utilize replace function

update table set tel= replace( tel, '0511', '0513' ) tel '0511%';

check sqlite core functions here

edit in case have match after first 4 digits of tel number. illustration 051121505113

update table set tel= replace(substr(tel,1,5), '0511', '0513' )||substr(tel,5) tel '0511%';

sqlite

No comments:

Post a Comment