Using the same driver as seen below. Here is some code that produces the error for my team.
library(odbc)
con <- dbConnect(odbc(),
Driver = "ODBC Driver 17 for SQL Server",
Server = "Server",
Database = "DB",
Authentication = "ActiveDirectoryIntegrated")
dbGetQuery(con,
"SELECT TOP 5 *
FROM TABLE
ORDER BY NEWID()"
)
library(RODBC)
con2 <- odbcDriverConnect("Driver={ODBC Driver 17 for SQL Server};
Server=Server;
Database=DB;
Authentication=ActiveDirectoryIntegrated;")
sqlQuery(channel = con2, stringsAsFactors = FALSE, query =
"SELECT TOP 5 *
FROM TABLE
ORDER BY NEWID()"
)
Let me know if anything else needs to be provided.