Data & CSV

SQL INSERT Generator

SQL INSERT Statement Generator

Type or paste rows into a grid and get INSERT statements for any major database.

About this tool

About SQL INSERT Generator

When you need a handful of rows in a table for testing, a bug report or a migration, writing INSERT statements by hand is slow and easy to get wrong. This generator gives you a small spreadsheet-style grid: type column names across the top, fill in values, and the INSERT statements update as you type. You can also copy a block of cells from Excel or Google Sheets and paste it into any cell; the grid grows to fit, and pasting into a column name uses the first line as headers. Each column has a type selector. Auto works out numbers, booleans and dates for you, or force Text to keep values such as 007 quoted. Choose MySQL, PostgreSQL, SQLite or SQL Server for the right identifier quotes, string escaping and boolean values, and optionally add a CREATE TABLE statement or write one INSERT per row. Empty cells become NULL and completely empty rows are skipped. Everything stays in your browser.

Built and maintained by Abhi JainUpdated

How to Generate INSERT Statements

  1. 1

    Enter the data

    Edit the column names and type values into the grid, or paste cells copied from Excel or Google Sheets. Use + Row and the + column button to grow it.

  2. 2

    Check the column types

    Leave a column on Auto or set it to Text, Number, Boolean or Date.

  3. 3

    Choose database and options

    Pick the database, set the table name, and tick Include CREATE TABLE or One INSERT per row if you want them.

  4. 4

    Copy the SQL

    Copy the statements from the right pane or download them as a .sql file.

SQL INSERT Generator: questions and answers

What is the syntax of an INSERT statement?

INSERT INTO table_name (column1, column2) VALUES (value1, value2); Several rows can share one statement: VALUES (1, 'a'), (2, 'b'); which is much faster than one statement per row.

How do I insert a value with an apostrophe?

Double it: 'O''Brien'. The generator does this automatically, and in MySQL also escapes backslashes.

How do I insert NULL?

Leave the cell empty. Empty cells are written as NULL without quotes, which is different from an empty string.

Can I paste data from Excel?

Yes. Copy a range of cells, click a cell in the grid and paste. Tab-separated data fills the grid from that cell, adding rows and columns as needed (up to 50 columns).

Does SQL Server need anything special?

SQL Server uses [brackets] for names, 1 and 0 for BIT values, and N'…' for Unicode text. Select SQL Server and the output follows those rules.