简体   繁体   English

R RODBC sqlUpdate或sqlQuery

[英]R RODBC sqlUpdate or sqlQuery

I am trying to insert a dataframe into a sql table. 我试图将数据帧插入到sql表中。 The sqlUpdate code gives a inherits(channel, "RODBC") channel is missing error Insertdata<-sqlUpdate(DBcon, df, tablename = "DataQuality", sqlColumns(special=FALSE)) My second attempt was this sqlUpdate代码给出了一个继承(通道,“RODBC”)通道丢失错误Insertdata<-sqlUpdate(DBcon, df, tablename = "DataQuality", sqlColumns(special=FALSE))我的第二次尝试是这个

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

sqlQuery shows an error of sqlQuery显示错误

[Microsoft][ODBC SQL Server Driver][SQL Server]Incorrect syntax near 'Nothing to add' [Microsoft] [ODBC SQL Server驱动程序] [SQL Server]'无法添加'附近的语法不正确

." (this is the first column and row of data) 。“(这是第一列和第一行数据)

"[RODBC] ERROR: Could not SQLExecDirect 'insert into DataQuality(Descriptions,Date,Name,Ref)SELECT Descriptions,Date,Name,Ref FROMc(\\"Nothing to add\\" “[RODBC]错误:无法将SQLExecDirect'插入DataQuality(描述,日期,名称,参考)SELECT描述,日期,名称,参考FROMc(\\”无需添加“

, and seems to stop at the end of the first column. ,似乎停在第一列的末尾。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM