SQL Server RODBC Connection

Brandon picture Brandon · Apr 19, 2011 · Viewed 96.5k times · Source

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

Thank you.

Answer

Henrico picture Henrico · Apr 19, 2011
library(RODBC)
dbhandle <- odbcDriverConnect('driver={SQL Server};server=mysqlhost;database=mydbname;trusted_connection=true')
res <- sqlQuery(dbhandle, 'select * from information_schema.tables')