Excel SQL Insert Generator App
During my undergrad studies, I took a class in database development and SQL which focused on RDBMS systems. The class required us to design, build, and populate tables in an Oracle PL/SQL environment. Because of the large amount of data I would have to generate and populate, I decided to build an Excel tool to generate the INSERT scripts rather than writing all the code by hand, which would be both tedious and more error prone.
I built the Insert Script Generator to solve those problems, and I later expanded it to support both SQL Server (Transact SQL) and MySQL in addition to PL/SQL. While these systems all have various methods for importing data (from BCP and PowerShell to bulk import commands to import/export wizards), those methods can be finicky and aren’t always the best choice, especially for one-off imports. As a result, this little tool has come in super handy over the years.
Try it out
To try out the Insert Script Generator, follow the instructions below:
- Download the latest version of the Insert Script Generator.
- Ensure Excel Macros are turned on, and click Allow or dismiss any warnings when opening the file.
- On the Start Here tab, select your SQL / RDBMS type from the Platform dropdown
- Enter the names of the columns you want to insert to and select a column format from the dropdown.
Use the following reference to determine the format for each column:- Unquoted Number for money, integers, or decimals. You can also use this for BIT datatypes that are already formatted as 1 or 0.
- Quoted Character Data for VARCHAR, CHAR, and NVARCHAR datatypes.
- Date for dates with no time
- Datetime for dates with times
- Time for time with no date
- Function for direct passthrough of unquoted input, e.g. SYSDATETIME()
- Boolean to convert TRUE/FALSE values to BITs
- Click the Add New Sheet button. The tool will create a new tab, named for the table name you entered.
- On your new tab, enter your data, starting in row 3.
- Click the Generate Insert Script button to generate your SQL file