sqlFetch Table not found error

旧城冷巷雨未停 提交于 2020-01-16 19:23:30

问题


After I use

cn<-odbcConnect(...)

to connect to MS SQL Server. I can successfully get data using:

tmp <- sqlQuery(cn, "select * from MyTable")

But if I use

tmp <- sqlFetch(cn,"MyTable") 

R would complain about "Error in odbcTableExists(channel, sqtable) : table not found on channel". Did I miss anything here?


回答1:


Assuming you work on Windows OS. When you define your "dsn" in Control panel > Administrative tools > System and Security > Data Sources (ODBC), you have to select a database as well. If you do that your code should work as expected.

So, the problem is not in your R code, but in your "dsn" string that in my opinion does not contain the reference to a database which is needed.



来源:https://stackoverflow.com/questions/26130616/sqlfetch-table-not-found-error

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!