[R] sqlSave()
cindy.dol
cindy.dolomieu at insa-lyon.fr
Wed Jul 4 12:15:14 CEST 2012
Julien Moeys:
ok, I see what is the problem,
Your example does not work because MS Access is trying to "update" values in
your table according to the ID you provide
So when you provide for instance ID = 1, MS Access will look in the table
for an existing record(s) that have an ID of 1, and replace the existing
value by the new one
When you provide ID = 16, MS Access will look in the table for an existing
record(s) that have an ID of 16, but will not find it, thus the error
So you should:
- use sqlSave() for the records that have an ID that is *not yet* in the
database table (in your example below, all ID > 10)
- use sqlUpdate() for the records that have an ID that is *already* in the
database table (and for which you want to update the values)
If you don't know in advance which ID are already in the database table, you
need to read the table first (to fetch existing ID's), and use that to
divide your table in 2 sets: one for already existing ID (for sqlUpdate),
and one for new ID (for sqlSave)
I hope that will help
Cheers
Julien
--
View this message in context: http://r.789695.n4.nabble.com/sqlSave-tp892040p4635387.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list