Toolstia / CSV to SQL INSERT generator
CSV to SQL INSERT generator
Paste CSV data with a header row, name the table, and get ready-to-run INSERT statements. Text is quoted safely, numbers are left bare and empty cells can become NULL.
Numbers are written without quotes and everything else as text, with single quotes doubled for safety. Values such as 007 stay text so leading zeros are kept. Always review the result before running it on a real database.
How it works
- Paste your CSV and type the table name.
- Choose the separator and the way column names are quoted for your database.
- Copy the SQL.
Quoting
Single quotes inside text are doubled, so O'Brien becomes 'O''Brien'. Column and table names are quoted in the style of the database you choose.
Numbers and text
Plain numbers are written without quotes. Values such as 007 or a phone number with a leading zero stay text so no digits are lost.
One statement or many
A single multi-row INSERT is fastest to run. Switch it off to get one INSERT per row, which is easier to debug.
Check before running
Review the output and try it on a copy of the data first. The tool cannot know your column types.
Questions
Does it create the table too?
No. It writes INSERT statements for a table that already exists.
What about commas inside values?
Wrap the value in double quotes in the CSV, such as "Smith, John", and it is read as one value.
Is my data stored?
Everything happens in your browser, and nothing you enter is sent anywhere.