R RODBC sqlUpdate 或 sqlQuery

R RODBC sqlUpdate or sqlQuery

我正在尝试将数据帧插入 sql table。 sqlUpdate 代码给出了 inherits(channel, "RODBC") channel is missing error Insertdata<-sqlUpdate(DBcon, df, tablename = "DataQuality", sqlColumns(special=FALSE)) 我的第二次尝试是这个

Insertdata<-sqlQuery(DBcon,paste("insert into DataQuality", df, sep = ""))

sql查询显示错误

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'Nothing to add'

."(这是数据的第一列和第一行)

"[RODBC] ERROR: Could not SQLExecDirect 'insert into DataQuality(Descriptions,Date,Name,Ref)SELECT Descriptions,Date,Name,Ref FROMc(\"Nothing to add\"

,似乎停在第一列的末尾。

Insertdata<-sqlSave( DBcon, df, "DataQuality",rownames=FALSE, append=TRUE) 这将使用新数据帧更新 SQL table。