SqlFetch table error not found

After use

cn<-odbcConnect(...) 

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

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

But if I use

 tmp <- sqlFetch(cn,"MyTable") 

R will complain about "Error in odbcTableExists (channel, sqtable): table not found on channel". Am I missing something here?

0
source share
1 answer

Assuming you are running Windows. When you define your dsn in Control Panel> Administrative Tools> System and Security> Data Sources (ODBC), you must select the database . If you do, your code should work properly.

So, the problem is not in your R code, but in your dsn line, which, in my opinion, does not contain a link to the required database.

+1
source

Source: https://habr.com/ru/post/969972/


All Articles