[R] RODBC sqlSave problem with bigint numbers

PtitBleu ptit_bleu at yahoo.fr
Wed Jul 27 09:04:27 CEST 2011


After a (bad) first try some months ago, I'm trying again to use RODBC
package instead of DBI+RMySQL packages to populate MySQL database.
The main command is

sqlSave(channel, data_df, tablename, append=T, rownames=FALSE,
colnames=FALSE, fast=FALSE, varTypes=vartypes)

where data_df is the data.frame I want to save and vartypes is obtained
following the tip given here
Useful Tips for RODBC 

Two columns have a bigint unsigned type.
The first contains numbers with 11 figures (like 20015301001)
The second colums has numbers with 13 figures (like 2002000103651)

First column are well saved in the database but, even with the same type,
numbers of the second one are truncated (this was not observed with RMySQL
2002000103651 become 2002000103000

The only solution I found at the moment, is to change the type of the second
column in the data.frame and in the database, that is use a char(13) instead
of bigint unsigned.
But it is not satisfactory.

Thanks in advance for any tip or solution,
Have a good day,
Ptit Bleu.

View this message in context: http://r.789695.n4.nabble.com/RODBC-sqlSave-problem-with-bigint-numbers-tp3697738p3697738.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list