Error in (function (classes, fdef, mtable) : unable to find an inherited method for function ‘dbReadTable’ for signature ‘"Microsoft SQL Server", "missing"’ >
Error pops up.
reprex::reprex({work<-dbReadTable(dbConn,table_name="Workdone")})
#> Error in dbReadTable(dbConn, table_name = "CrewDuties"): could not find function "dbReadTable"
I found an alternative solution.
I am using
dbGetQuery() function. In which I pass SQL query and extract desired records into a data frame.
The beauty of the function is it can accept complicated SQL queries (one which are long and have many functions) and can make the query "dynamic" in shiny app by initializing input variables.
For example:-
query<-paste0("SELECT E.ShortName, E.StaffID, C.FlightDate, C.DutyCode
From ops.CrewDuties C Inner Join Com.EMPLOYEE E On C.EmployeeID = E.EmployeeID WHERE FlightDate between '",input$date1,"'AND '",input$date2,"'")
Crew_duties<-dbGetQuery(dbConn,query)