RODBC: merge tables from different databases (channel)

做~自己de王妃 提交于 2019-12-01 18:08:40

This question is similar to the question here. The answer seems to be that RODBC cannot access two different databases in a single query, using sqlQuery(...), because the connection (channel) is database-specific. So either

(1) do it using downloads (as in your code), or 
(2) have your DBA put both tables in a single database, or 
(3) use something other than R. 

In Netezza it is working fine using sqlQuery function.

require("RODBC")

ch <- odbcConnect("NZSQL")

dim.cust.acc1  <- sqlQuery(ch,"Select * from DB1..DIM_ACCOUNT a inner join DB2..BASE_201707 b on a.id_number=b.id_number limit 1000",believeNRows = FALSE)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!