CSV to SQL INSERT Generator
Paste CSV with a header row and get INSERT statements for your table, with names and values quoted the way your database expects.
Use the tool
Loading the tool…
About CSV to SQL INSERT Generator
Turn CSV rows into SQL INSERT statements, so they can be loaded into a database table. Choose the separator, or let the tool detect it.
Worked example
Paste `id,name,city` with two rows. The tool writes an INSERT statement for each row.
Limits
Check the statements before you run them on a database, and test on a copy first. Values that contain quotation marks or special characters need care.
How to use CSV to SQL INSERT Generator
- Paste your CSV and give the table name.
- Choose the SQL flavour and how many rows per statement.
- Choose how numbers and empty cells are written.
- Copy the SQL.
Good to know
- Single quotes in text are doubled, so a value such as it's is safe inside the statement.
- Numbers with a leading zero, such as zip codes, stay as text.
- Check the statements on a copy of your data before running them on a real database.
- Up to 100,000 data rows at a time.
Frequently asked questions
Which databases does it support?
Names are quoted for PostgreSQL, SQLite and Oracle with double quotes, MySQL and MariaDB with backticks, and SQL Server with square brackets.
How are empty cells written?
As NULL by default. You can choose an empty text value instead.
Does it create the table?
No. It writes INSERT statements only. Create the table first with the column names in the header row.