Consider this simple database:
CREATE TABLE T1 (TestID INTEGER PRIMARY KEY, X INTEGER NOT NULL, Y NOT NULL, Z NOT NULL, UNIQUE(X, Y)); CREATE TABLE T2 (TestID INTEGER NOT NULL, X2 INTEGER NOT NULL, Y2 NOT NULL, Z2 NOT NULL); What would be the most efficient way of copying all T1 entries + their corresponding 0..N T2 entries from one database to another (both with the same schema)? Note that TestID=1 in Database1 could be a totally different item than TestID=1 in Database2! Also pay attention to the UNIQUE-clause. It implies "semi-unique coordinates" in this case, which makes the merge a bit harder (perhaps an "INSERT OR IGNORE" is sufficient here?)! I tried "INSERT INTO T1 from (SELECT * FROM Database2.T1)" but soon realized SQLite does not handle this properly. E.g. SQL Server takes care of the primary key in this case. SQLite doesn't! Also, how would I copy all T2-items properly? Using triggers? Thanks for your help! /Chris _________________________________________________________________ Vem är du? Gör personlighetstestet på MSN Dejting! http://dejting.se.msn.com/channel/index.aspx?trackingid=1002952 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users