{"id":649,"date":"2012-03-16T23:04:00","date_gmt":"2012-03-16T22:04:00","guid":{"rendered":"http:\/\/sburke.eu\/blog\/?p=649"},"modified":"2022-07-25T23:27:40","modified_gmt":"2022-07-25T22:27:40","slug":"sql-drill-excel-add-in-for-building-and-running-sql-queries","status":"publish","type":"post","link":"http:\/\/sburke.eu\/blog\/2012\/03\/sql-drill-excel-add-in-for-building-and-running-sql-queries\/","title":{"rendered":"SQL Drill &#8211; Excel Add-In for building and running SQL queries"},"content":{"rendered":"\n<h2>About SQL-Drill<\/h2>\n\n\n\n<p>Building complex SQL queries for a particular database can take some time and effort. SQL-Drill is a simple Excel Add-in which can connect to a SQL Server or MySQL Database, show all the tables, and allow you to easily pick what columns you want to select data from. It will take care of the inner selects and joins, and will give you the final SQL query (which you can use in SQL Server Management Studio for reports etc.)<\/p>\n\n\n\n<h2>Installation<\/h2>\n\n\n\n<ol><li>Download from:&nbsp;<a href=\"http:\/\/www.sqldrill.com\/\">http:\/\/www.sqldrill.com\/<\/a>&nbsp;(local&nbsp;<a href=\"http:\/\/winadmin.sburke.eu\/wp-content\/uploads\/2012\/03\/sql_drill_setup.zip\" target=\"_blank\" rel=\"noreferrer noopener\">mirror<\/a>)<\/li><li>Install MSI setup<\/li><li>Run as Administrator &#8211; a Command Prompt<br>regsvr32 &#8220;C:\\Program Files (x86)\\SQL Drill\\SQLDrill.dll&#8221;<\/li><li>Open Excel. The Add-Ins tab should now show, and in this Tab, will be &#8220;SQL Drill&#8221;<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/install-sql-drill-excel.jpg\"><img loading=\"lazy\" width=\"450\" height=\"204\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/install-sql-drill-excel.jpg\" alt=\"\" class=\"wp-image-651\" srcset=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/install-sql-drill-excel.jpg 450w, http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/install-sql-drill-excel-300x136.jpg 300w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/a><figcaption>How SQL-Drill will appear in Excel once installed.<\/figcaption><\/figure>\n\n\n\n<h2>Connect&nbsp;with SQL Server<\/h2>\n\n\n\n<p>Connecting to SQL Server is very easy. Click the New\/Edit, Add a new Profile, Edit the Connection String, choose &#8220;Microsoft OLE DB Provider for SQL Server&#8221; click next, enter the server name, and login details (or SA details). Clicking &#8220;Test Connection&#8221; should return &#8220;Test connection succeeded&#8221;.<a href=\"http:\/\/winadmin.sburke.eu\/wp-content\/uploads\/2012\/03\/connect-sqldrill-to-sqlserver.gif\"><\/a>Connect SQL-Drill to Microsoft SQL Server<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/connect-sqldrill-to-sqlserver-1024x762-1.gif\"><img loading=\"lazy\" width=\"1024\" height=\"762\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/connect-sqldrill-to-sqlserver-1024x762-1.gif\" alt=\"\" class=\"wp-image-652\"\/><\/a><figcaption>Create ODBC Connection to MySQL<a href=\"http:\/\/winadmin.sburke.eu\/wp-content\/uploads\/2012\/03\/connect-sql-drill-to-mysql.gif\"><\/a>Connect SQL-Drill to MySQL via ODBC<\/figcaption><\/figure>\n\n\n\n<h2>Connect&nbsp;with MySQL Server<\/h2>\n\n\n\n<p>Connecting SQL-Drill with MySQL Server is a little more involved than connecting to Microsoft SQL Server. There are two main Steps. One is setting up the ODBC Connection in the Windows ODBC Data Sources. Two is using this connection inside of SQL-Drill.<\/p>\n\n\n\n<ol><li>Download and install&nbsp;the&nbsp;<a rel=\"noreferrer noopener\" href=\"http:\/\/dev.mysql.com\/downloads\/connector\/odbc\/5.1.html\" target=\"_blank\">MySQL ODBC Connector<\/a><br>(<em>I had to install&nbsp;<strong>both<\/strong>&nbsp;mysql-connector-odbc-5.1.10-winx64.msi and mysql-connector-odbc-5.1.10-win32.msi as I was on Win7 x64 with Excel x32<\/em>)<\/li><li>START -&gt; Search\/Run -&gt; odbcad32<br>This should open the &#8220;ODBC Data Source Administrator&#8221; app.<br>(<em>Also accessible from: Control Panel &#8211; Administrative Tools &#8211; Data Sources (ODBC)<\/em>)<\/li><li>Under &#8220;User DSN&#8221;, choose Add. Choose &#8220;MySQL ODBD 5.1 Driver&#8221;, and click Finish.<\/li><li>In the MySQL Connector\/ODBC, enter the Connection details. Click Test and it should return &#8220;Test Successful&#8221;.<\/li><li>Open up Excel. Open up SQLDrill.<br>Click the New\/Edit, Add a new Profile, Edit the Connection String, choose &#8220;<strong>Microsoft OLE DB Provider for ODBC Drivers<\/strong>&#8221; click next. Under &#8220;Use data source name&#8221; click the drop-down, and the earlier ODBC connection&nbsp;should be there.&nbsp;Clicking &#8220;Test Connection&#8221; should return &#8220;Test connection succeeded&#8221;.<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/create-odbc-connection-to-MySQL-1024x220-1.gif\"><img loading=\"lazy\" width=\"1024\" height=\"220\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/create-odbc-connection-to-MySQL-1024x220-1.gif\" alt=\"\" class=\"wp-image-653\"\/><\/a><figcaption>Create ODBC Connection to MySQL<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/connect-sql-drill-to-mysql-1024x785-1.gif\"><img loading=\"lazy\" width=\"1024\" height=\"785\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/connect-sql-drill-to-mysql-1024x785-1.gif\" alt=\"\" class=\"wp-image-654\"\/><\/a><figcaption>Connect SQL-Drill to MySQL via ODBC<\/figcaption><\/figure>\n\n\n\n<p>Reference: -&gt;&nbsp;<a href=\"http:\/\/blog.mclaughlinsoftware.com\/microsoft-excel\/accessing-to-mysql\/\">http:\/\/blog.mclaughlinsoftware.com\/microsoft-excel\/accessing-to-mysql\/<\/a><\/p>\n\n\n\n<h2>Using SQL Drill<\/h2>\n\n\n\n<p>SQL-Drill is very easy to use. After connecting, all the tables are shown on the right. Drag and drop tables into the workspace. Tick the columns you want data from; the select query will be visible, and you can execute the query.<\/p>\n\n\n\n<p>SQL-Drill worked great for a SQL Server Database as it identified all foreign keys and relationships between the tables. As a result it made intelligent select statements.<\/p>\n\n\n\n<p>For MySQL however, sql drill didn&#8217;t identify multiple foreign keys and as a result did not have the relationship between the tables. As a result for MySQL, it did not create intelligent select statements (i.e. with Joins and inner selects).<a href=\"http:\/\/winadmin.sburke.eu\/wp-content\/uploads\/2012\/03\/sql-drill-example-usage.gif\"><\/a>SQL-Drill Usage on a SQLServer DB showing the relationships identified between tables.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sql-drill-example-usage-1024x671-1.gif\"><img loading=\"lazy\" width=\"1024\" height=\"671\" src=\"http:\/\/sburke.eu\/blog\/wp-content\/uploads\/2022\/07\/sql-drill-example-usage-1024x671-1.gif\" alt=\"\" class=\"wp-image-655\"\/><\/a><figcaption>SQL-Drill Usage on a SQLServer DB showing the relationships identified between tables.<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>About SQL-Drill Building complex SQL queries for a particular database can take some time and effort. SQL-Drill is a simple Excel Add-in which can connect to a SQL Server or MySQL Database, show all the tables, and allow you to &hellip; <a href=\"http:\/\/sburke.eu\/blog\/2012\/03\/sql-drill-excel-add-in-for-building-and-running-sql-queries\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[59,49],"_links":{"self":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/649"}],"collection":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/comments?post=649"}],"version-history":[{"count":2,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/649\/revisions"}],"predecessor-version":[{"id":657,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/posts\/649\/revisions\/657"}],"wp:attachment":[{"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/media?parent=649"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/categories?post=649"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/sburke.eu\/blog\/wp-json\/wp\/v2\/tags?post=649"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}