2009-08-12 13 views

Antwort

11

@ laalto Antwort nahe ist, aber es wird hochkant Fällen nicht funktionieren, speziell wenn 'a) ' an anderer Stelle in der Zeichenfolge auftritt. Sie möchten SUBSTR verwenden, um nur die ersten 3 Zeichen zu entfernen.

sqlite> SELECT REPLACE ("a) I have some information (or data) in the file.", "a) ", ""); 
I have some information (or datin the file. 

sqlite> SELECT SUBSTR ("a) I have some information (or data) in the file.", 4); 
I have some information (or data) in the file. 

seine Abfrage So aktualisieren, sollten sie verwandeln sich in:

UPDATE tbl SET col=SUBSTR(col, 4) WHERE col LIKE 'a) %'; 

... noting that strings are indexed from 1 in SQLite.

8

können Sie REPLACE verwenden auch Teile einer Zeichenfolge zu löschen:

UPDATE tbl SET col=REPLACE(col, 'a) ', '') WHERE col LIKE 'a) %'; 
Verwandte Themen