SQLite is not supporting to delete[Drop] a column from table using alter table command. To delete a column we can save existing data to a temporary table, drop the old table, create the new table, then copy the data back in from the temporary table. For creating new table with existing table the following query can be used.
CREATE TABLE NEW_TABLE_NAME AS
SELECT [ column1, column2...columnN ]
FROM EXISTING_TABLE_NAME
[ WHERE ]
But my scenario is little tricky. I don't know how many existing column exist in the table. I know only the column name to remove from the table. So how to create a new table using existing table without specific column. Note: I don't know the existing column names in the table.
Aucun commentaire:
Enregistrer un commentaire