Advertisement
Guide
About the SQL INSERT Generator
Getting a spreadsheet of data into a database usually means either an import wizard you do not trust or hand-writing a hundred INSERT statements. This generates them for you, with values escaped properly so a name like O'Brien cannot break the statement.
Useful for seed data, test fixtures, and one-off migrations.
Escaping is the whole point
The reason not to build INSERT statements with string concatenation is that a single apostrophe ends the string literal early and everything after it is parsed as SQL. This tool doubles apostrophes (''), which is the one escape every dialect agrees on, and quotes identifiers using each dialect's own convention. That said, generated SQL is for data you control — for user input in a running application, always use parameterised queries instead.
One statement per row, or batched
A batched insert — one INSERT with many VALUEStuples — is dramatically faster, because the database parses and plans once instead of once per row. One statement per row is easier to read and edit, and means a single bad row does not fail the whole batch. Batches of 100 to 1,000 are a reasonable default; very large batches can exceed a server's maximum packet size.
How types are decided
Values that look like integers or decimals are written unquoted, true and false become booleans, and empty cells become NULL if you enable that. One deliberate exception: a very long digit string is kept as text rather than a number, because JavaScript cannot represent integers beyond about 9 quadrillion exactly, and silently rounding an ID would be worse than quoting it.
Dialect differences that matter
PostgreSQL and SQLite quote identifiers with double quotes, MySQL with backticks, SQL Server with square brackets. PostgreSQL has real TRUE and FALSE literals; MySQL and SQL Server use 1 and 0. The optional CREATE TABLE adjusts its column types per dialect too.
How to use it
- 1Paste CSV with a header row, or a JSON array of objects.
- 2Set the table name and pick your database.
- 3Choose batched or one statement per row.
- 4Copy the SQL or download it as a .sql file.
Frequently asked questions
How are apostrophes handled?
They are doubled, which is the standard SQL escape. A value like O’Brien becomes 'O''Brien' and runs correctly on every dialect.
Should I use batched or single inserts?
Batched is much faster for large imports because the database parses once. Use one per row when you want readable, individually editable statements, or need a bad row to fail on its own.
Can it create the table too?
Yes. Enable “Include CREATE TABLE” and column types are inferred from the data. Treat it as a starting point — it cannot infer keys, indexes or constraints.
Why is my long ID quoted as a string?
Because JavaScript loses precision on integers above roughly 9 quadrillion. Quoting keeps the exact digits rather than silently rounding them.
Is my data uploaded?
No. Parsing and generation both happen in your browser.
