Reputation: 10755
I have sqlite database in which I have table "scripts" in that table I have columns, on of a column which name is "fname" have values like this
111/222/333
111/222
111/222/444/555
111/888/777
now I want to update all values whcih contains 222, so I want to run command and update values like following 222 to 000
111/000/333
111/000
111/000/444/555
111/888/777
How I can do that ?
Upvotes: 1
Views: 286
Reputation: 6258
you can replace the string occurrence ...
update whatever_table
set whatever_field = replace(whatever_field, '222', '000')
where (WHATEVER)
Upvotes: 2
Reputation: 18873
public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy);
Execute a query to find the 222
Cursor c=query.("scripts","fname",null,null,"/222/",null);
Once you get the cursor object, you can loop through the Cursor which contains all rows that has "/222/".
Upvotes: 1