Productivity and Utilities

CSV to SQL INSERT Generator

Convert CSV rows into SQL you can review and run on a test database.

Paste CSV here or choose a file below. Up to 5,000,000 characters and 100,000 rows. Nothing is uploaded.

Your files stay on your device. They are processed in your browser and are never uploaded to SumPanda.

Use table or schema.table. The name is quoted for you.

Sets how names and text are quoted.

From 1 to 5,000. SQL Server allows 1,000 at most.

Review this SQL before you run it on a real database. Column types are guesses from the values, and values are written as text or plain numbers by rule, so they may still need changes for your schema, constraints or character set. Run it on a test copy first.

Next step

How to use the csv to sql insert generator

  1. Paste CSV text or choose a CSV file. Choose the separator if it is not a comma.
  2. Enter the table name, pick the database and decide whether the first row is a header.
  3. Choose whether to include a CREATE TABLE statement with guessed column types, and whether empty values become NULL.
  4. Pick a multi row or one per row INSERT style, copy or download the SQL, and review it before you run it.

How values are written

Text is wrapped in single quotes and any single quote inside it is doubled, so O'Brien becomes 'O''Brien'. For MySQL and MariaDB a backslash is also doubled, because they treat it as an escape by default. SQL Server text gets the N prefix so Unicode letters are kept. Names are quoted with double quotes, backticks or square brackets as the database expects, and a quote character inside a name is doubled.

A column is written as a plain number only if every filled value in it looks like a whole number or a decimal with no leading zeros, so a ZIP code like 02134 stays text. Dates in the form 2024-02-29 are checked to be real dates, and anything else is text. Types for CREATE TABLE are guesses from the values and you should change them to fit your design.

Reading the CSV

The reader follows the common CSV rules: values in double quotes may hold the separator and line breaks, and a double quote inside them is written twice. Rows that are longer than the header are an error with the row number, because that usually means an unquoted separator. Shorter rows are filled with empty values and counted.

A header with a blank or repeated name is given a unique one. Files up to 5,000,000 characters and 100,000 data rows are accepted. For conversion to JSON instead, use the CSV to JSON converter, and to create sample rows to load, try the fake data generator.

Review before you run

SQL made by a tool can still be wrong for your database: a column may need a different type, a constraint may reject a row, and some systems limit how many rows one statement can hold. Run the output on a test copy first. Nothing you paste is uploaded, and no database is contacted. To tidy JSON or lists first, see the JSON formatter and the compare two lists tool.

Assumptions and limits

  • Column types are guesses from the values and should be reviewed.
  • Text escaping follows the rules for the database you choose, and other settings, such as a database that treats backslashes differently, may need changes.
  • SQL Server statements are limited to 1,000 rows each.
  • The output is a script for you to read and run on a test database first.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

How do I convert CSV to SQL INSERT statements?

Paste the CSV, enter a table name and choose your database. The tool writes an INSERT with a row for each line, plus an optional CREATE TABLE.

How are quotes in values handled?

A single quote inside a value is doubled, which is how SQL writes a quote inside text. Names are quoted too, with their own quote character doubled.

Why was my ZIP code written as text?

Numbers with leading zeros are kept as text, because writing 02134 as a number would drop the zero.

What does the tool do with empty values?

By default it writes NULL. Turn that option off to write empty text instead.

Is it safe to run the output?

Read it first and run it on a test copy. The tool escapes values by rule, but it cannot know your table design or your data's rules.