Am Sun, 15 May 2011 17:10:53 -0500 schrieb Mr. Puneet Kishor: > sqlite doesn't support changing the name of a table column (and, neither you > nor > your user should be doing this -- there is something strange with your app >requirements). That said, you can "rename" a column by creating a new table >with >the new column definitions and copy data from the old table to the new table. > > CREATE TABLE new_table (id, eventName, dateAdded); > INSERT INTO new_table (id, eventName, dateAdded) SELECT id, eventName, date > FROM old_table;
Alternatively, one can rename the old_table ... ALTER TABLE old_table RENAME TO old_table_raw; ... and then create a view with the name of the old_table: CREATE VIEW old_table AS SELECT old_col_name AS new_col_name FROM old_table_raw; After that, "SELECT new_col_name FROM old_table" will return the same data as "SELECT old_col_name FROM old_table" would have returned before the renaming operation, but with the new column name, without the need to copy all the data and thus avoiding database inflation. Wolfgang _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users