SQLite - replace part of a string

后端 未结 3 1689
没有蜡笔的小新
没有蜡笔的小新 2020-12-07 13:34

Is it possible using SQL in an SQLite table to replace part of a string?

For example, I have a table where one of the fields holds the path

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 14:18

    You can use the built in replace() function to perform a string replace in a query.

    Other string manipulation functions (and more) are detailed in the SQLite core functions list

    The following should point you in the right direction.

    UPDATE table SET field = replace( field, 'C:\afolder\', 'C:\anewfolder\' ) WHERE field LIKE 'C:\afolder\%';

提交回复
热议问题