On 5 Oct 2009, at 2:59pm, Reusche, Andrew wrote: > We are trying to programmatically update the primary keys on this > table, in order to sync it up with a remote database. In the event > that > this needs to occur, we typically need to take a chunk of records in > this table, and increment all the "sales_id"'s - integer, primary > key - > to a higher number. Do you anticipate that this could cause a > problem?
Never ever ever do this. It leads to endless problems, especially if your synchronisation plan does not work properly even one time. An autogenerated ROWID in the form SQLite uses should not be changed. If you need to make sure that records in different copies of a database have the same key, invent your own UNIQUE key column, and generate a key that cannot be duplicated across copies. For instance if you have four branches, the key could be 'B02C01231' for a customer of branch 2. When you first copy the record from one copy of the database to the other, the value in the key column gets copied along with it all the other columns. There are very many problems associated with synchronising two copies of the same database. I'm serious: entire books are written about just this one subject. Judging from the questions here I should write one myself. If you come up with a solution yourself, think it through very carefully, and try it out small scale before investing lots of time in writing the software. The only real solution is to maintain the database online and access it remotely from each site. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users