Sqlite: multiple update (find and replace) case insensitive

后端 未结 2 1880
星月不相逢
星月不相逢 2021-01-21 15:10

I use DB Browser for SQLite to visualize and update an sqlite file.

I am able to do run a case sensitive query to update some text like this:

UPDATE ite         


        
2条回答
  •  温柔的废话
    2021-01-21 15:23

    Nosyara answer works great but it only removes 1 instance at a time.

    I also tried this from here:

    UPDATE itemNotes  
    SET 
      note = SUBSTR(note, 0, INSTR(LOWER(note), 'sometext')) || 'abc' || SUBSTR(note, INSTR(LOWER(note), 'sometext')+sometext_len)
    WHERE 
      note LIKE "%sometext%";
    

    But when I have many occurence of sometext in a field note, then only the first on is removed. Based on a comment on this question, I ended up using python to replace the sqlite, see here

提交回复
热议问题