Connecting SQL Server Management Studio to Microsoft Dynamics via ODBC Driver


In order to avoid incorrect integration with MS SSMS, the working environment must meet the following conditions:

  • an 3rd party ODBC Driver, like Devart ODBC for Dynamic 365, click below link for more info.
  • The driver, studio, and SQL Server must be of the same bitness. For example, if you are using 64-bit SQL Server Management Studio on 64-bit Windows platform, then configure the 64-bit version of the driver using ODBC Administrator launched from %windir%\system32\odbcad32.exe. Otherwise, configure the driver using the 32-bit version of ODBC Administrator – launch it from %windir%\SysWOW64\odbcad32.exe.
  • ODBC Driver for Dynamics CRM and SQL Server must be installed on the same computer.
  • .NET Framework 4.5 must be installed on the computer.
  • The data source must be a configured system DSN. Refer to below 6 steps to learn how to configure a System DSN.
  1. After the driver is installed, it can be configured. For this, in the Control Panel open Administrative Tools and find the Data Sources (ODBC) tool:Data_Sources_tool
  2. Now you have to add the ODBC Driver for Dynamics CRM to the list of System Data Sources or User Data Sources or File Data Sources using the ODBC Data Source Administrator dialog.added_DSN
  3. For this, click the Add button – the Create New Data Source dialog will appear with a list of available drivers.Select ODBC Driver for Dynamics CRM and click Finish.create_DSNThen you will be suggested to configure the driver.
  4. To activate the driver via ODBC Administrator, refer to the Product Activation article for more details.
  5. In the appeared connection dialog, you can set the connection options.connection_settings_dn
  6. Then you can click OK and finish configuration or switch to the Advanced settings tab to specify more detailed Connection String

Connecting to Dynamics from SQL Server Management Studio using ODBC Driver for Dynamics

You can use the Microsoft SQL Server Management Studio to connect your Dynamics data to an SQL Server instance. Linked Server is a tool of MS SQL Server that allows to execute distributed queries to refer tables stored on non-SQL Server datbase in a single query. With linked servers, you can execute commands against different data sources such as Dynamics and merge them with your SQL Server database. You can create a linked server with one of these methods: by using the options in the Object Explorer or by executing stored procedures.

Below are major advantages of using SQL Server Linked Servers to connect to Dynamics:

  1. The ability to connect other database instances on the same or remote server.
  2. The ability to run distributed queries on heterogeneous data sources across the organization.
  3. The ability to work with diverse data sources in the same way.

How to configure a SQL Server Linked Server to connect to Dynamics

You can follow the steps to create a linked server for Dynamics in SQL Server Management Studio by using Object Explorer:

  1. Start your Management Studio and choose your SQL Server instance.
  2. In the Object Explorer pane, expand the Server Objects, right-click on Linked Servers and then click on New Linked Server.
  3. Configure your linked server in the dialog box:
    • Give a name for your server in the Linked server field.
    • Under Server type, select Other data source .
    • Choose Microsoft OLE DB Provider for ODBC Drivers in the Provider drop-down list.
    • In the Data source field, enter the name of your DSN, e.g. Devart ODBC Driver for Dynamics . Alternatively, you can input the ODBC Driver connection string in the Provider field.

The linked server will appear under the Linked Servers in the Object Explorer Pane. You can now issue distributed queries and access Dynamics databases through SQL Server.

Retrieving Data From Dynamics

Disable the Allow inprocess option of MSDASQL OLE DB Provider for ODBC Drivers. For this, find the MSDASQL provider in the list of Linked Servers and double-click on it


In the appeared Provider Options window, clear the Allow inprocess checkbox:


Create a new Linked Server


Make sure to select Microsoft OLE DB Provider for ODBC Drivers and specify the following parameters:


The Dynamics tables are already available to be fetched. To query the linked server, click New Query in the toolbar:


Enter your SQL query in the editor window and click Execute to run the query:


As a result, you can see the contents of the selected table retrieved directly from the Dynamics account you are connected to.


If the Linked Server was created with the Allow inprocess option enabled, then you should delete this Linked Server and create it again with the Allow inprocess option disabled.