R ODBC - Query a column name with spaces
I am trying to execute a request via R OBDC. But one column name takes place on it. Eg [Account No]
.
I am using this code to request:
esiid_ac <- sqlQuery(myconn, paste("
SELECT * FROM CustomerUsage WHERE ((CustomerUsage.Account No ='", 12345, "')) ", sep=""),as.is=TRUE)
I am getting the following error:
[1] "42000 102 [Microsoft] [ODBC Driver 11 for SQL Server] [SQL Server] Incorrect syntax next to" No "." [2] "[RODBC] ERROR: Failed SQLExecDirect '\ n SELECT * FROM CustomerUsage WHERE ((CustomerUsage.Account No =' 678987 '))'
How to solve this?
Is it possible to read this table with the column index instead of the column names?
Thank.
+3
source to share
5 answers