[R] syntax to connect to linked SQL server using RODBC

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Tue Sep 13 16:59:06 CEST 2016


This is not an R concept, and it may be highly specific to the SQL Server API rather than the ODBC API. You might try doing as the Posting Guide recommends and posting in the R-sig-db mailing list. I would also recommend that you figure out from Microsoft documentation what programming API your GUI software example is using to accomplish this rather than referring to that GUI program in your question.
-- 
Sent from my phone. Please excuse my brevity.

On September 13, 2016 7:02:20 AM PDT, Varun Sinha <sinha.varuna85 at gmail.com> wrote:
>Hi All,
>
>I would like to know how to connect to a "linked server" from R. I find
>the
>linked server under Server Objects > Linked Servers on SQL management
>studio.
>
>Here is the current way I am using to connect to the server:
>
>dbhandle <- odbcDriverConnect('driver={SQL
>Server};server=servername;database=databasename;trusted_connection=true')
>
>table1 <- as.data.table(sqlQuery(dbhandle, 'select a, b from table1'))
>
>Could you please let me know the syntax to do the same but with the
>linked
>server instead? I would like to connect to a database on the linked
>server
>and run the query to pull data.
>
>Thank you for your help.
>
>Best regards,
>Varun
>
>	[[alternative HTML version deleted]]
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list