SYMPTOMS
When a SQLNumResultCols call is executed on a statement handle, on which
you perform a SELECT query on a table and the word ORDER or GROUP appears
anywhere in the table's name, SQLNumResultCols returns one of the following
errors:
SQLState=37000,
szErrorMsg=[Microsoft][ODBC Microsoft Access 2.0 Driver] Syntax error
in FROM clause
-or-
SQLState=S0002,
szErrorMsg=[Microsoft][ODBC Microsoft Access 2.0 Driver] Couldn't
find input table or query <xx>
For example, assume two tables exist in the database called ordering and
reordering, respectively. Then the following sequence of calls will exhibit
this behavior:
Case A
SQLPrepare(hstmt,"select * from ordering",SQL_NTS)
SQLNumResultCols(hstmt,pccol)
Returns SQL_ERROR.
SQLError(henv,hdbc,hstmt1,szSQLState,pfNativeError,SZErrorMsg)
Returns
SQLState=37000
szErrorMsg=[Microsoft][ODBC Microsoft Access 2.0 Driver] Syntax error
in From clause
Case B
SQLPrepare(hstmt,"select * from reordering",SQL_NTS)
SQLNumResultCols(hstmt,pccol)
Returns SQL_ERROR.
SQLError(henv,hdbc,hstmt1,szSQLState,pfNativeError,SZErrorMsg)
Returns
SQLState=S0002
szErrorMsg=[Microsoft][ODBC Microsoft Access 2.0 Driver] Couldn't
find input table or query 're'
Also, these errors are returned for table names that contain the word
GROUP, like regroup, regrouping. Other examples of the table names that
have the problem are border, camcorder, or grouped.