SQLite Modify Column

后端 未结 4 1397
迷失自我
迷失自我 2020-12-02 22:26

I need to modify a column in a SQLite database but I have to do it programatically due to the database already being in production. From my research I have found that in or

4条回答
  •  南笙
    南笙 (楼主)
    2020-12-02 22:57

    When I ran "CREATE TABLE tmp_table AS SELECT id, name FROM src_table", I lost all the column type formatting (e.g., time field turned into a integer field

    As initially stated seems like it should be easier, but here is what I did to fix. I had this problem b/c I wanted to change the Not Null field in a column and Sqlite doesnt really help there.

    Using the 'SQLite Manager' Firefox addon browser (use what you like). I created the new table by copying the old create statement, made my modification, and executed it. Then to get the data copied over, I just highlighted the rows, R-click 'Copy Row(s) as SQL', replaced "someTable" with my table name, and executed the SQL.

提交回复
热议问题