Problems with sqlSave
On Tue, Nov 11, 2008 at 6:06 PM, Grey Moran <grey.moran at gmail.com> wrote:
Hello, I am trying to load data into SQL Server as follows (example simplified for discussion purposes). The returned error complains of a non existent table, which I can nevertheless "see":
channel <- odbcConnect("MktRisk")
createTable.q <- "CREATE TABLE dbo.Arrests (State CHAR(20) NOT NULL,
MURDER DECIMAL(6,3) NOT NULL, ASSAULT INTEGER NOT NULL, URBANPOP INTEGER NOT NULL, RAPE DECIMAL(6,3));"
sqlQuery(channel, createTable.q);
character(0)
sqlTables(channel)
TABLE_CAT TABLE_SCHEM TABLE_NAME TABLE_TYPE REMARKS ................. 19 MktRisk dbo sysusers SYSTEM TABLE <NA> 20 MktRisk dbo Arrests TABLE <NA> ..................
sqlSave(channel, dat=USArrests, tablename=Arrests, rownames = "state",
addPK=TRUE) Error in sqlSave(channel, dat = USArrests, tablename = Arrests, rownames = "state", : object "Arrests" not found
You need quotes around "Arrests", I think. Sean
in the real case (more complex and hard to show here), I get this error: Error in sqlSave(channel, dat = the.bridge.df, tablename = someTable, : unable to append to table 'US15Aug2008BridgeTable' As far as I can tell, the tables I create are of the appropriate kind - any ideas what might be the problem? Thank you, Grey
_______________________________________________ R-sig-DB mailing list -- R Special Interest Group R-sig-DB at stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-db