Rename table in sqlite

android, sqlite

Solution

Try `execSQL` instead of `rawQuery` like:

ourDatabase.execSQL("ALTER TABLE " + original_table_name + " RENAME TO " + new_table_name);

Problem

I am trying to rename a table in my app's `sqlite` database. For that I am using the following command: ``` ourDatabase.rawQuery("ALTER TABLE " + oldName + " RENAME TO " + newName, null); ``` where `oldName` is old name of the table, `newName` is the new name of table and `ourDatabase` is an instance of `SQLiteDatabase`. But this is not working. What's the mistake ? Thanks.

Original source