CSV/JSON to SQL INSERT Generator
Paste CSV or a JSON array to get INSERT statements for your table name and SQL dialect. Numbers, booleans and strings are detected automatically, and a CREATE TABLE statement can be included. To tidy the generated SQL, use the SQL Formatter; to reshape the source data first, try the CSV ⇔ JSON Converter.
🔒 Runs in your browser · Your data is never sent to a server
Column types
Leave a field empty to use the inferred type (shown in gray). Type a value or pick a suggestion. How values are written in the INSERT statements does not change.
Notes
- Types are inferred from the whole column: all integers become INT/BIGINT, any decimal becomes DOUBLE, only true/false becomes BOOLEAN, and everything else is text. Values with leading zeros (such as 007) and integers longer than 18 digits are kept as text.
- Table and column names are always quoted (backticks for MySQL, square brackets for SQL Server, double quotes for PostgreSQL, SQLite and Oracle). SQL Server strings are written as N-prefixed (national) literals. "schema.table" is split at the dot and each part is quoted.
- In JSON, nested objects and arrays are inserted as JSON strings, and missing keys become NULL. Numbers are first read as JavaScript numbers, so very large values may lose precision.
- Multi-row VALUES are split into a new INSERT every 1,000 rows (the SQL Server per-statement limit). Oracle has no multi-row VALUES, so INSERT ALL is used, and Oracle treats an empty string as NULL. Always try the generated SQL on a test database before running it against production.
Glossary
INSERT statement
An SQL statement that adds new rows to a table, written as INSERT INTO table (columns…) VALUES (values…).
Multi-row VALUES
Listing several value tuples in one INSERT to add many rows at once. It is usually faster than one statement per row, but an overly long statement can hit database limits.
SQL dialect
The syntax differences between databases, such as identifier quoting (backticks in MySQL, double quotes in PostgreSQL and SQLite) and the names of types and boolean literals.
NULL
The special SQL value meaning "no value". It is distinct from an empty string.
FAQ
How are column types inferred?
The whole column is examined. All integers become INT (BIGINT for long ones), any decimal becomes DOUBLE, and only true/false becomes BOOLEAN. Anything else, including values with leading zeros such as ZIP or phone numbers, becomes text.
Do empty fields become NULL or an empty string?
NULL by default. Turn off "Treat empty fields as NULL" to get an empty string (''). In JSON, null and missing keys become NULL.
How does the output differ between SQL dialects?
Identifier quoting (backticks for MySQL, square brackets for SQL Server, double quotes for the others), type names and boolean literals (1/0 for SQLite, SQL Server and Oracle) change. MySQL also escapes backslashes in strings, SQL Server uses N'…' literals, and Oracle emits multiple rows as INSERT ALL.
Can I convert a large number of rows?
Processing happens in your browser, so the limit is your browser memory. Multi-row VALUES are split into a new INSERT every 1,000 rows, which helps stay under per-statement limits on the database side.
Share this page
