{"id":3131,"date":"2021-10-26T22:27:52","date_gmt":"2021-10-27T05:27:52","guid":{"rendered":"https:\/\/SUMMALAI.COM\/?p=3131"},"modified":"2021-10-26T22:27:54","modified_gmt":"2021-10-27T05:27:54","slug":"connecting-sql-server-management-studio-to-microsoft-dynamics-via-odbc-driver","status":"publish","type":"post","link":"https:\/\/SUMMALAI.COM\/?p=3131","title":{"rendered":"Connecting SQL Server Management Studio to Microsoft Dynamics via ODBC Driver"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Requirements<\/h2>\n\n\n\n<p>In order to avoid incorrect integration with MS SSMS, the working environment must meet the following conditions:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>an 3rd party ODBC Driver, like Devart ODBC for Dynamic 365, click below link for more info. <a href=\"https:\/\/www.devart.com\/odbc\/dynamics\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.devart.com\/odbc\/dynamics\/<\/a><\/li><li>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 &#8211; launch it from %windir%\\SysWOW64\\odbcad32.exe.<\/li><li>ODBC Driver for Dynamics CRM and SQL Server must be installed on the same computer.<\/li><li>.NET Framework 4.5 must be installed on the computer.<\/li><li>The data source must be a configured system DSN. Refer to below 6 steps&nbsp;to learn how to configure a System DSN.<\/li><\/ul>\n\n\n\n<ol class=\"wp-block-list\"><li>After the driver is installed, it can be configured. For this, in the Control Panel open Administrative Tools and find the&nbsp;<strong>Data Sources (ODBC)<\/strong>&nbsp;tool:<img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/data_sources_tool.png\" alt=\"Data_Sources_tool\"><\/li><li>Now you have to add the ODBC Driver for Dynamics CRM to the list of&nbsp;<strong>System Data Sources<\/strong>&nbsp;or&nbsp;<strong>User Data Sources<\/strong>&nbsp;or&nbsp;<strong>File Data Sources<\/strong>&nbsp;using the&nbsp;<strong>ODBC Data Source Administrator<\/strong>&nbsp;dialog.<img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/added_dsn.png\" alt=\"added_DSN\"><\/li><li>For this, click the&nbsp;<strong>Add<\/strong>&nbsp;button &#8211; the&nbsp;<strong>Create New Data Source<\/strong>&nbsp;dialog will appear with a list of available drivers.Select ODBC Driver for Dynamics CRM and click Finish.<img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/create_dynamics_dsn.png\" alt=\"create_DSN\">Then you will be suggested to configure the driver.<\/li><li>To activate the driver via ODBC Administrator, refer to the&nbsp;<a href=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/product_activate.htm\">Product Activation<\/a>&nbsp;article for more details.<\/li><li>In the appeared connection dialog, you can set the connection options.<img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/connection_settings_dn.png\" alt=\"connection_settings_dn\"><\/li><li>Then you can click OK and finish configuration or switch to the&nbsp;<strong>Advanced settings&nbsp;<\/strong>tab to specify more detailed Connection String<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Connecting to Dynamics from SQL Server Management Studio using ODBC Driver for Dynamics<\/h3>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Below are major advantages of using SQL Server Linked Servers to connect to Dynamics:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>The ability to connect other database instances on the same or remote server.<\/li><li>The ability to run distributed queries on heterogeneous data sources across the organization.<\/li><li>The ability to work with diverse data sources in the same way.<\/li><\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">How to configure a SQL Server Linked Server to connect to Dynamics<\/h3>\n\n\n\n<p>You can follow the steps to create a linked server for Dynamics in SQL Server Management Studio by using Object Explorer:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Start your Management Studio and choose your SQL Server instance.<\/li><li>In the&nbsp;<strong>Object Explorer pane<\/strong>, expand the&nbsp;<strong>Server Objects<\/strong>, right-click on&nbsp;<strong>Linked Servers<\/strong>&nbsp;and then click on&nbsp;<strong>New Linked Server<\/strong>.<\/li><li>Configure your linked server in the dialog box:<ul><li>Give a name for your server in the&nbsp;<strong>Linked server<\/strong>&nbsp;field.<\/li><li>Under&nbsp;<strong>Server type<\/strong>, select&nbsp;<strong>Other data source<\/strong>&nbsp;.<\/li><li>Choose&nbsp;<strong>Microsoft OLE DB Provider for ODBC Drivers<\/strong>&nbsp;in the&nbsp;<strong>Provider<\/strong>&nbsp;drop-down list.<\/li><li>In the&nbsp;<strong>Data source<\/strong>&nbsp;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&nbsp;<strong>Provider<\/strong>&nbsp;field.<\/li><\/ul><\/li><\/ol>\n\n\n\n<p>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.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Retrieving Data From Dynamics<\/h3>\n\n\n\n<p>Disable the&nbsp;<strong>Allow inprocess option<\/strong>&nbsp;of MSDASQL OLE DB Provider for ODBC Drivers. For this, find the&nbsp;<strong>MSDASQL<\/strong>&nbsp;provider in the list of Linked Servers and double-click on it<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/msdasql.png\" alt=\"msdasql\"\/><\/figure>\n\n\n\n<p>In the appeared&nbsp;<strong>Provider Options<\/strong>&nbsp;window, clear the&nbsp;<strong>Allow inprocess<\/strong>&nbsp;checkbox:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/allowinprocess.png\" alt=\"allowinprocess\"\/><\/figure>\n\n\n\n<p>Create a new&nbsp;<strong>Linked Server<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/newlinkedserver.png\" alt=\"newlinkedserver\"\/><\/figure>\n\n\n\n<p>Make sure to select&nbsp;<strong>Microsoft OLE DB Provider for ODBC Drivers<\/strong>&nbsp;and specify the following parameters:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/provideroptions.png\" alt=\"provideroptions\"\/><\/figure>\n\n\n\n<p>The Dynamics tables are already available to be fetched. To query the linked server, click&nbsp;<strong>New Query<\/strong>&nbsp;in the toolbar:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/newquery.png\" alt=\"newquery\"\/><\/figure>\n\n\n\n<p>Enter your SQL query in the editor window and click&nbsp;<strong>Execute<\/strong>&nbsp;to run the query:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.devart.com\/odbc\/dynamics\/docs\/SSMS-SQL.png\" alt=\"accounttable\"\/><\/figure>\n\n\n\n<p>As a result, you can see the contents of the selected table retrieved directly from the Dynamics account you are connected to.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Attention<\/h3>\n\n\n\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Requirements 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. https:\/\/www.devart.com\/odbc\/dynamics\/ The driver, studio, and SQL Server must be of the same bitness. For example, if you are using 64-bit <a class=\"read-more\" href=\"https:\/\/SUMMALAI.COM\/?p=3131\">Read More<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[627,497],"tags":[643],"class_list":["post-3131","post","type-post","status-publish","format-standard","hentry","category-bi-and-reporting","category-solutions","tag-connecting-sql-server-to-microsoft-dynamics"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3131"}],"version-history":[{"count":3,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3131\/revisions"}],"predecessor-version":[{"id":3698,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=\/wp\/v2\/posts\/3131\/revisions\/3698"}],"wp:attachment":[{"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3131"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3131"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/SUMMALAI.COM\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}