[R] non-SQL sqlQuery error
pvirketis at hbk.com
Mon Feb 10 21:04:10 CET 2003
I've encountered a curious problem. I am trying to run an SQL query
using sqlQuery() function in RODBC.
The query works fine when run in a stand-alone SQL browser (Microsoft
Query Analyzer, in particular).
However, when I use the exact same thing from sqlQuery() function, I get
the following error:
Error in "[.data.frame"(data, , ) : not all specified columns exist
Traceback() gives this:
5: stop("not all specified columns exist")
4: "[.data.frame"(data, , )
3: data[, ]
2: sqlGetResults(channel, errors = errors, ...)
1: sqlQuery(con.object, " ... long query here ... ")
The puzzling thing is that the error does not seem to be like the usual
mispecified-SQL type that I normally
get when using sqlQuery(). I am not sure how to debug this problem,
since I can't really see what's going on
in the sqlQuery() internally.
My query includes a "SUM(ColumnName1) GROUP BY ColumnName2" construct,
and from trial and error, it seems
that this is the cause of the failure (at least removing it makes the
error go away).
I am using R1.6.2 and the RODBC package from
Can anyone offer any clues?
More information about the R-help