Cannot Open Table ‘Case’ and ‘Order’ in SSMS with ODBC Driver for Salesforce

Cannot Open Table ‘Case’ and ‘Order’ in SSMS with ODBC Driver for Salesforce

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:
SELECT * FROM Order

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.
    • Related Articles

    • Setting up a Connection to ODBC in Delphi Using Devart ODBC Driver

      This guide will walk you through the steps of setting up a connection to an ODBC driver in Delphi. We'll use ODBC Driver for Salesforce as an example. Prerequisites: Devart ODBC Driver for Salesforce installed on your machine. A Salesforce account ...
    • Guide: Configuring ODBC Driver in Azure Data Factory

      This guide walks you through the steps of setting up and using an ODBC driver in Azure Data Factory (ADF) for seamless data integration. By following this guide, you will be able to configure an ODBC driver, create a Linked Service, and define an ...
    • How to Work in Power Query Using ODBC Driver

      1. Connect to an ODBC Source In Power BI Desktop, go to the Home tab and click on Get Data to connect to an ODBC source. From the list of available connections, select the DSN connection that you created in the ODBC Administration tool. You can learn ...
    • Setting Up MongoDB Atlas and Connecting via Devart ODBC Driver

      This article will guide you through the process of setting up MongoDB Atlas, creating a cluster, configuring access, obtaining the connection string, and connecting to MongoDB Atlas using the Devart ODBC Driver for MongoDB. 1. Creating a Cluster in ...
    • Setting up a Connection to QuickBooks Desktop Using Devart ODBC Driver

      This knowledge base article provides step-by-step instructions on how to set up a connection to QuickBooks Desktop using the Devart ODBC Driver. Following these steps will help you successfully connect to QuickBooks Desktop and retrieve your ...