[R] SQL Queries from Multiple Servers

Mark Wardle mark at wardle.org
Fri May 15 13:00:43 CEST 2009


Depending on your requirements, one option would be to do the join in
R using merge()

If you wish to run SQL joins across multiple databases, then it is not
an R problem but a database problem. For a quick solution, I would
write scripts that bring all your data together into one database
(could be written in any scripting language, and of course R) and then
process from there.



2009/5/13 Tom Schenk Jr <tomschenkjr at gmail.com>:
> I use RODBC as my conduit from R to SQL. It works well when the tables are
> stored on one channel, e.g.,
> channel <- odbcConnect("data_base_01", uid="....", dsn="....")
> However, I often need to match tables across multiple databases, e.g.,
> "data_base_01" and "data_base_02". However, odbcConnect() appears limited
> insofar as you may only query from tables within a single channel, e.g.,
> database. I do not have access to write and create new tables on the SQL
> servers, which is a possible solution (e.g., copy all tables into a single
> database).
> Is there any way, in RODBC or another R-friendly SQL package, to perform SQL
> operations across multiple databases?
> Warm regards.
> --
> Tom Schenk Jr.
> tomschenkjr at gmail.com
>        [[alternative HTML version deleted]]
> ______________________________________________
> R-help at r-project.org mailing list
> 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.

Dr. Mark Wardle
Specialist registrar, Neurology
Cardiff, UK

More information about the R-help mailing list