User builds a query of Access tables in Query Builder. He attempts to execute the query and the following error occurs:
System.Data.Odbc.OdbcException: ERROR [42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
Stack trace:
at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod)
at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader)
at System.Data.Odbc.OdbcCommand.ExecuteReader(CommandBehavior behavior)
at System.Data.Odbc.OdbcCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at Quest.Toad.Db.ToadDataAdapter.InternalReadBackground()
Dashes are used in table names. Table names with dashes are prohibited in SQL statements that use ODBC calls.
RESOLUTION 1:
Under "Generated Query" tab of Query Builder right-click on the query and select "Open in Editor" option. Query will be sent to a new Editor window. Modify the From clause of query and enclose the database and table names with brackets as such:
FROM `dbname.mdb`.table-name `table-name`
change it to:
FROM [dbname.mdb].[table-name] `table-name`
RESOLUTION 2:
Change the naming convention of table names and use underscores "_" instead of dashes "-".
© 2021 Quest Software Inc. ALL RIGHTS RESERVED. Feedback Terms of Use Privacy