SQL INSERT Generator
Generate SQL INSERT statements from CSV or JSON records for multiple database types.
Quick Preset Samples
SQL Configuration
Total Rows3 rows
Columns Detected4 cols
Output Lines8
SQL File Size306 B
SQL INSERT Generator — convert CSV and JSON data into SQL statements
Seeding a database or migrating data often requires converting spreadsheet exports or API responses into SQL INSERT statements. This tool parses CSV (with header row) or JSON arrays and generates correctly quoted INSERT statements for MySQL, PostgreSQL, SQLite, and SQL Server. Numbers stay unquoted, strings are single-quoted with escaped apostrophes, and NULL values are handled. Use batch mode to combine multiple rows into a single VALUES list for better import performance.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Turning CSV or JSON data into INSERT statements.
- Producing seed data for a test database.
- Generating statements to review before running them.
- Loading a small dataset without an ETL tool.
- Producing dialect-appropriate statements for a target database.
Frequently Asked Questions
- Why batch rows into one INSERT?
- Because each statement carries its own round trip and transaction overhead. A multi-row INSERT of a thousand rows is typically an order of magnitude faster than a thousand statements — which is the difference between a seeding script finishing in seconds and in minutes.
- How large should a batch be?
- Usually 500 to 1,000 rows. Beyond that you hit statement size limits — MySQL's `max_allowed_packet` in particular — and a single failure rolls back the whole batch, so very large batches trade speed for a harder recovery.
- How are quotes escaped?
- By doubling, which is standard SQL: `O'Brien` becomes `'O''Brien'`. Backslash escaping works in MySQL and not in PostgreSQL by default, so doubling is the portable choice and the one that will not surprise you on a migration.
- Is generated SQL safe to run?
- Read it first. The escaping is correct, but the values come from data you may not have written, and a crafted string attempting to break out of a literal is a real attack class. For untrusted input, a parameterised bulk loader is the safer path.
- What is ON CONFLICT for?
- Idempotent seeding. `ON CONFLICT DO NOTHING` in Postgres, or `INSERT IGNORE` in MySQL, lets a script be re-run without failing on rows that already exist — which is what makes a seed file safe to include in a repeatable setup process.
Common errors and gotchas
- Choosing a dialect whose date and boolean literals differ from the target's, which fails at execution.
- Losing the empty-versus-null distinction, where an empty field could mean either.
- Emitting statements without an explicit column list, which breaks the moment the table changes.
- Trusting the column order to match the table, when a rename shifts everything silently.
- Assuming every dialect accepts multi-row VALUES syntax, which not all do.
Related Developer Utilities tools
RegExp Tester
Test regular expressions and inspect matches locally.
Regex Visualizer
Visual regex pattern diagram with live match highlighting and capture group annotations.
Subnet Calculator
Compute CIDR subnets, usable hosts, and network ranges.
Cron Parser
Translate cron syntax into plain English.
URL Parser
Break a URL into protocol, host, path, and query parts.
HTML Previewer
Paste HTML and see it rendered live in a safe, sandboxed preview.
HTTP Status Code Reference
Search and look up every HTTP status code and its meaning.
MIME Type Lookup
Find the MIME type for a file extension, or the extensions for a MIME type.