I am trying to connect RStudio to MSSQL 2016 and I am getting the error message indicated in the subject line. Code is below:
install.packages("RODBC")
library(RODBC)
con < - odbcConnect("AdventureWorksDW", uid="RUser", pwd="Swim1212**")
df_adventureworks <- as.data.frame(sqlQuery(con, "select * from
vw_FactSales"), stringsAsFactors = FALSE)
close (con)
The error messages I get are:
con < - odbcConnect("AdventureWorksDW", uid="RUser", pwd="Swim1212**")
Error: object 'con' not found
df_adventureworks <- as.data.frame(sqlQuery(con, "select * from vw_FactSales"), stringsAsFactors = FALSE)
Error in inherits(channel, "RODBC") : object 'con' not found
close (con)
Error in close(con) : object 'con' not found