Hi.  I battling my way through the Attach command and I can't get my simple
test to work.

Given a database named "ultra2008.sql" that contains a table named "ultra"
and a database named "archive2007.sql" that also contains a table named
"ultra" where the databases and tables have identical structures, shouldn't
these statements insert ultra's data from archive2007.sql into
ultra2008.sql?
(For brevity I've removed the error checking lines for this posting.)

sqlite3 *pDB = NULL; 
sqlite3_open("ultra2008.sql", &pDB);
sqlite3_exec(pDB, "attach 'archive2007.sql' as arc", NULL, NULL, NULL);
sqlite3_exec(pDB, "insert into main.ultra select * from arc.ultra", NULL,
NULL, NULL);
sqlite3_close(pDB);

After this function runs, the databases are left with the same data inside
of them so something isn't right.

I appreciate your input.
-Dan

-- 
View this message in context: 
http://www.nabble.com/Problem-using-Attach-to-insert-data-from-another-table-tp17958315p17958315.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to