SQL Server RODBC Connection

后端 未结 5 633
滥情空心
滥情空心 2020-11-28 03:10

Does anyone have a connection string example for using RODBC and connecting to MS SQL Server 2005 or 2008.

Thank you.

5条回答
  •  再見小時候
    2020-11-28 03:42

    Try to use RSQLS package: https://github.com/martinkabe/RSQLS

    Very fast pushes data from data.frame to SQL Server or pulls from SQL Server to data.frame.

    Example:

    library(devtools)
    install_github("martinkabe/RSQLS")
    library(RSQLS)
    
    cs <- set_connString("LAPTOP-USER\\SQLEXPRESS", "Database_Name")
    push_data(cs, dataFrame, "dbo.TableName", append = TRUE, showprogress = TRUE)
    df <- pull_data(cs, "SELECT * FROM dbo.TableName", showprogress = TRUE)
    

    This solution is much faster and more robust than RODBC::sqlSave or DBI::dbWriteTable.

提交回复
热议问题