jose isaias cabrera <cabr...@wrc.xerox.com>
wrote:
> I am updating an sqlite db from another sqlite db and it is working
> fine, unless the record does not exists.  ie.
>
>     "ATTACH db2 AS client; ";
>
>     BEGIN;
>     INSERT OR REPLACE INTO LSOpenJobs
>           SELECT * FROM client.LSOpenJobs
>             WHERE login='x' AND XtraB > '2000';
>     COMMIT;
>
> this works fine if the record already exists in the db getting
> updated. However, if the record was deleted, inadvertively, from the
> db getting updated, this will not work.

What do you mean, will not work? In precisely what way does the observed 
behavior differ from one you expect?

> Is there a way to insert the record back in the db getting updated if
> it is not there?

That's precisely what the INSERT part of "INSERT OR REPLACE" would do.

Or are you saying that there's a record that isn't currently in the main 
db (perhaps it existed some time ago, but was deleted) nor in the 
attached db, and you expect SQLite to somehow magically conjure it up 
out of thin air? I don't think real world works quite this way.

Igor Tandetnik 



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

Reply via email to