[R] [RODBC] ERROR: Could not SQLExecDirect

Dieter Menne dieter.menne at menne-biomed.de
Wed Jul 26 15:30:13 CEST 2006


Peter Eiger <Peter.Eiger <at> gmx.net> writes:

> I've got a problem with RODBC and saving (sqlSave) of a dataframe in Access.
> R 2.0.1 is running on windows XP.
> 
> When executing the examples in R help for the "USArrests" data set "sqlSAve"
works fine, but running
> sqlSave() for a dataframe "Adat" 
> 
> > str(Adat)
> `data.frame':   1202 obs. of  18 variables: 
> 
> containing 18 columns and ca. 1200 rows fails.
> 
> I get the following error message:
> 
> > sqlSave(channel, Adat)
> Error in sqlSave(channel, Adat) : [RODBC] ERROR: Could not SQLExecDirect
> 
> The data was fetched from the same Access database before and was not
manipulated before the attempt to save.

Try to set rownames = FALSE in sqlSave, it's TRUE by default which I believe is
a bit unfortunate. And probably append=TRUE. It's also good to try with
fast=FALSE first.

When I get an error of that type, I first save to a non-existing table, and do a
compare of what comes out with the original table.

Dieter



More information about the R-help mailing list