第一步:创建数据源(方法见下面链接)

http://www.2cto.com/database/201412/365396.html

第二步:在R中输入以下代码:

#####SQL SERVER与R语言互连######
library(RODBC);
dbhandle <- odbcDriverConnect('driver={SQL Server};server=(local);database=TESTdatabase;trusted_connection=true');#TESTdatabase为数据库
res <- sqlQuery(dbhandle, 'select * from  class ');#class为TESTdatabase数据库中表
sqlSave(dbhandle,res,"A",append=FALSE);
odbcClose(dbhandle);

 

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-11-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-06-14
  • 2021-07-21
相关资源
相似解决方案