Re: [sqlite] Copy records from one DB to another
On Tue, 24 Apr 2007 19:57:31 +0200, Yuriy Martsynovskyy <[EMAIL PROTECTED]> wrote: What is the best way to copy records between tables located in different DB files? Hi, I want to extend this question: How to best copy records from one database (linked via different tables) to an other database? How to keep record references in sync? Because if a new records is in the destination table it gets a new auto-increment ID and all references need to be adjusted. Thanks. -- Robert M. Münch http://www.robertmuench.de - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Copy records from one DB to another
Yuriy Martsynovskyy wrote: What is the best way to copy records between tables located in different DB files? Both DBs have completely the same structure. I need to add records from table in DB1 to table in DB2. Logically something like this: INSERT INTO .table1 SELECT * FROM .table1 Yuriy, You have it correct. Open the DB1 sqlite3 db1.db > attach db2.db as db2; > insert into table1 select * from db2.table1; > .quit You do basically the same thing using the C API. Open one database, then issue an attach command for the other. HTH Dennis Cote - To unsubscribe, send email to [EMAIL PROTECTED] -
Re: [sqlite] Copy records from one DB to another
"Yuriy Martsynovskyy" <[EMAIL PROTECTED]> wrote: > What is the best way to copy records between tables located in > different DB files? > Both DBs have completely the same structure. I need to add records > from table in DB1 to table in DB2. Logically something like this: > > INSERT INTO .table1 > SELECT * > FROM .table1 > See http://www.sqlite.org/lang_attach.html and combine that with what you have above and you are good to go. -- D. Richard Hipp <[EMAIL PROTECTED]> - To unsubscribe, send email to [EMAIL PROTECTED] -
[sqlite] Copy records from one DB to another
What is the best way to copy records between tables located in different DB files? Both DBs have completely the same structure. I need to add records from table in DB1 to table in DB2. Logically something like this: INSERT INTO .table1 SELECT * FROM .table1 - To unsubscribe, send email to [EMAIL PROTECTED] -