sqlite append two tables from two databases that have the exact same schema

前端 未结 2 2056
醉话见心
醉话见心 2021-02-06 01:47

I\'m writing data into an sqlite database, but because the data set is very large, I\'m splitting the process into five pieces. As a result, I\'m writing to five different sqlit

2条回答
  •  滥情空心
    2021-02-06 02:01

    You can use ATTACH to make the contents of another database file accessible in the same connection:

    ATTACH "/some/where/db2.sqlite" AS db2;
    INSERT INTO main.MyTable SELECT * FROM db2.MyTable;
    

    (The main database is always called main; opening a new database connection is the equivalent of ATTACH "filename" AS main.)

提交回复
热议问题