Error With Sqlsave
Solution 1:
I had the same problem. What I realized is that by default sqlSave would create the table in the 'Master' schema. I launched the ODBC Data Source Administrator and changed the default database and selected the desired database and it worked.
Solution 2:
I found this post googling for a similar problem. The problem persisted after restarting R, as well as a system re-boot. I narrowed the problem down to the database, by opening a new connection to different database, and writing to that using sqlSave.
Weirdly, the problem with the original database was corrected by opening and closing it using R:
DBchannel <- odbcConnectAccess(access.file = "C:/myPath/Data.mdb")
odbcClose(DBchannel)
After doing this, the following test worked just fine:
require(RODBC)
dd <- data.frame('normal' = rnorm(100), 'uniform' = runif(100))
DBchannel <- odbcConnectAccess(access.file = "C:/myPath/Data.mdb")
sqlSave(DBchan, dd, tablename='testtable')
odbcClose(DBchannel)
(which is nice, as my initial (non-)solution was to re-build the database)
Solution 3:
I have struggled witrh same issue with you. I can call odbcQuery to insert data line by line. However, my data.frame has tens of miliions of line. It's kind of to oslow by insert. If your data set is not large, you may try it.
Solution 4:
Please try this
sqlSave(channel, b, "_b", append = TRUE,
rownames = FALSE, colnames = FALSE, safer = TRUE, fast = FALSE)
What I found is that the Excel will add a "_" in front of the default filename, if you add this to the filename, Excel will find the table.
Solution 5:
You have to remove your brackets ([]), and then it should run fine.
Post a Comment for "Error With Sqlsave"