Skip to content Skip to sidebar Skip to footer

How To Delete All Value From A Column In Sqlite With A Single Click?

I want a button that deletes all the values inside a column with a single button click. I know the code to delete the row or table but not all the values in it. Is it possible or

Solution 1:

Something like this should be working:

ContentValues values=new ContentValues();
values.put(<COLUMN_NAME>, (String) null);
database.update(<TABLE_NAME>, values, null, null);

<COLUMN_NAME>, and <TABLE_NAME> are Strings, containing the column you want to clear and table name :)

Also, you can assign not only null value to <COLUMN_NAME>, but any other value you want. I.e.: 0, or "" (empty string), depending on your needs.

Post a Comment for "How To Delete All Value From A Column In Sqlite With A Single Click?"