The method I did doesn’t work at all, the column is still Exist. This is my SQL:
db.execSQL("CREATE TEMPORARY TABLE Evaluation_backup(" + allColumnName + ");"
+ "INSERT INTO Evaluation_backup SELECT "+ allColumnName +" FROM Evaluation;"
+ "DROP TABLE Evaluation;"
+ "CREATE TABLE Evaluation("+ allColumnName + ");"
+ "INSERT INTO Evaluation SELECT "+ allColumnName + "FROM Evaluation_backup;"
+ "DROP TABLE Evaluation_backup;");
allColumnName is String containing all column names except the name of the column to be deleted. The contents of allColumnName are as follows: column1, column2,column3.
Thanks in advance.
execSql
Say:
Execute a single SQL statement …
Call db once for each statement .execSql.
Because I can’t comment here: How do I delete column from sqlite table in android?
The method I did does not work at all, the column still exists. This is my SQL:
db.execSQL("CREATE TEMPORARY TABLE Evaluation_backup(" + allColumnName + ");"
+ "INSERT INTO Evaluation_backup SELECT "+ allColumnName +" FROM Evaluation;"
+ "DROP TABLE Evaluation;" < br /> + "CREATE TABLE Evaluation("+ allColumnName + ");"
+ "INSERT INTO Evaluation SELECT "+ allColumnName +" FROM Evaluation_backup;"
+ "DROP TABLE Evaluation_backup;");< /pre>allColumnName is String containing all column names except the name of the column to be deleted. The content of allColumnName is as follows: column1,column2,column3.
Thanks in advance.
documentation for
execSql
says:Execute a single SQL statement …< /p>
Call db.execSql once for each statement.