i have a string like this a) Text in my sqlite databse..i want to remove a) from databse..anyone know a query for this?
A:
You can use REPLACE
also to delete parts of a string:
UPDATE tbl SET col=REPLACE(col, 'a) ', '') WHERE col LIKE 'a) %';
laalto
2009-08-12 15:38:34
+3
A:
@laalto's answer is close, but it will not work on edge cases, specifically if 'a) '
occurs elsewhere in the string. You want to use SUBSTR
to only remove the first 3 characters.
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.
So updating his query, it should turn into:
UPDATE tbl SET col=SUBSTR(col, 4) WHERE col LIKE 'a) %';
Mark Rushakoff
2009-08-12 16:17:44