I'm struggling to append a new row of data into an existing SQL Server database.
These:
sqlQuery(con, paste("INSERT INTO df1 SELECT * FROM df2"))
sqlQuery(con, paste("INSERT INTO df1 SELECT * FROM ", df2))
sqlQuery(con, paste("INSERT INTO df1 SELECT * FROM ", sqldf("SELECT * FROM df2")))
All produce an error:
[1] "42S02 -1305 [Microsoft][ODBC Microsoft Access Driver] The Microsoft Jet database engine cannot find the input table or query 'col_1_val'. Make sure it exists and that its name is spelled correctly."
[2] "[RODBC] ERROR: Could not SQLExecDirect 'INSERT INTO df1 SELECT * FROM col_1_val'"
col_1_val
is the first column value in df2
Going the sqlSave
route:
sqlSave(con, df2, tablename = "df1", append = TRUE, rownames = FALSE, colnames = FALSE)
throws a memory allocation error:
Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : 'Calloc' could not allocate memory (1073741824 of 1 bytes)