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.)
- Download from: http://www.sqldrill.com/ (local mirror)
- Install MSI setup
- Run as Administrator – a Command Prompt
regsvr32 “C:\Program Files (x86)\SQL Drill\SQLDrill.dll”
- Open Excel. The Add-Ins tab should now show, and in this Tab, will be “SQL Drill”
Connect with SQL Server
Connecting to SQL Server is very easy. Click the New/Edit, Add a new Profile, Edit the Connection String, choose “Microsoft OLE DB Provider for SQL Server” click next, enter the server name, and login details (or SA details). Clicking “Test Connection” should return “Test connection succeeded”.
Connect with MySQL Server
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.
- Download and install the MySQL ODBC Connector
(I had to install both 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)
- START -> Search/Run -> odbcad32
This should open the “ODBC Data Source Administrator” app.
(Also accessible from: Control Panel – Administrative Tools – Data Sources (ODBC))
- Under “User DSN”, choose Add. Choose “MySQL ODBD 5.1 Driver”, and click Finish.
- In the MySQL Connector/ODBC, enter the Connection details. Click Test and it should return “Test Successful”.
- Open up Excel. Open up SQLDrill.
Click the New/Edit, Add a new Profile, Edit the Connection String, choose “Microsoft OLE DB Provider for ODBC Drivers” click next. Under “Use data source name” click the drop-down, and the earlier ODBC connection should be there. Clicking “Test Connection” should return “Test connection succeeded”.
Using SQL Drill
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.
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.
For MySQL however, sql drill didn’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).