Does anyone have a connection string example for using RODBC and connecting to MS SQL Server 2005 or 2008.
Thank you.
Click “Packages” à Install package(s)… from the RGui Toolbar. If you have not already selected a mirror for CRAN downloads, do so by selecting a mirror that will best serve your geographic location. Select “RODBC” from the package list. The RODBC package has been successfully installed.
The RODBC package provides access to databases (including Microsoft Access and Microsoft SQL Server) through an ODBC interface. The primary functions are given below. Function. Description. odbcConnect(dsn, uid="", pwd="")
library(RODBC) dbhandle <- odbcDriverConnect('driver={SQL Server};server=mysqlhost;database=mydbname;trusted_connection=true') res <- sqlQuery(dbhandle, 'select * from information_schema.tables')
Taken from a posting to r-help:
library(RODBC)
channel <- odbcDriverConnect("driver=SQL Server;server=01wh155073")
initdata<- sqlQuery(channel,paste("select * from test_DB ..
test_vikrant"))
dim(initdata)
odbcClose(channel)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With