When working with SQL Server Management Studio (SSMS) and the Devart ODBC Driver for Salesforce, you may encounter difficulties accessing certain tables such as Case or Order.
Important Note on SSMS Behavior
Queries in SSMS are first processed by SQL Server’s internal syntax parser. As a result, the query actually sent to the ODBC driver may differ from the one you entered. For instance, when querying a table named Order—a reserved keyword in SQL—the query:
SELECT * FROM [SALESFORCE]...[Order]
may be internally transformed into:
This transformation causes errors because the provider receives an invalid or unintended query.
Recommended Workaround
To avoid these issues and ensure the correct SQL is passed directly to the ODBC driver via SQLExecDirect, it is recommended to use the OPENQUERY or EXEC operators.
Example:
SELECT *
FROM OPENQUERY([SALESFORCE],
'SELECT ColumnName1, ColumnName2 FROM [Order] WHERE ColumnName = ''your_value''')
This approach bypasses the internal parser and executes your query exactly as written, avoiding conflicts with reserved keywords like Order or Case.