Hi, it seems to me that between LSOpenProjects and LSOpenSubProjects you have a 1:n relationship, and also between LSOpenSubProjects and LSOpenJobs. Also, it seems that you want to copy data from an attached database "c" to the main database. So, if you want to preserve this relationship in your main database, you have to use one transaction, Command #2, and rollback in case of failure.
Martin jose isaias cabrera wrote: > Greetings. > > which command is safer to use: > > Command #1: > > BEGIN; > INSERT OR REPLACE INTO LSOpenProjects > SELECT * FROM c.LSOpenProjects > WHERE ProjID = 2000; > COMMIT; > BEGIN; > INSERT OR REPLACE INTO LSOpenSubProjects > SELECT * FROM c.LSOpenSubProjects > WHERE ProjID = 2000; > COMMIT; > BEGIN; > INSERT OR REPLACE INTO LSOpenJobs > SELECT * FROM c.LSOpenJobs > WHERE ProjID = 2000; > COMMIT; > > > Command #2: > > BEGIN; > INSERT OR REPLACE INTO LSOpenProjects > SELECT * FROM c.LSOpenProjects > WHERE ProjID = 2000; > INSERT OR REPLACE INTO LSOpenSubProjects > SELECT * FROM c.LSOpenSubProjects > WHERE ProjID = 2000; > INSERT OR REPLACE INTO LSOpenJobs > SELECT * FROM c.LSOpenJobs > WHERE ProjID = 2000; > COMMIT; > > This latter one is failing every so often. But, it should not matter much, > since it is writing to three different tables. I should say that there is > always, just one LSOpenProject record; at least, one LSOpenSubProjects > records and, at least, one LSOpenJobs record. But 99% of the time, there is > always more than one LSOpenJobs. > > Any ideas? > > thanks, > > josé > > > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

