CSV to SQL INSERT
Runs 100% in your browserConvert CSV to SQL INSERT statements with dialect hints, identifier quoting, NULL and type policies, batching, and row diagnostics — nothing uploaded.
CSV / TSV input
SQL INSERT output
Generation review
WaitingA parsed table preview will appear here after generating SQL.
Session-only generation history
Recent runs disappear when this page closes.
Frequently asked questions
A CSV to SQL INSERT converter reads CSV or TSV data and produces SQL INSERT statements you can paste into a database client, migration script, or seed file. ToolsSonic's converter parses headers from the first row, quotes identifiers according to your chosen dialect, escapes apostrophes in string values, infers numbers, booleans, and NULL tokens, groups rows into batches, and lets you download the result as a .sql file — all in your browser.
Six dialects are available: Generic SQL (standard double-quote identifiers), PostgreSQL (double-quote identifiers), MySQL (backtick identifiers), SQLite (double-quote identifiers), SQL Server (square-bracket identifiers), and Oracle (double-quote identifiers). Selecting a dialect sets the default identifier quoting mode, which you can override manually.
Identifier quoting wraps column and table names in dialect-appropriate delimiters to prevent conflicts with reserved words and names containing spaces or special characters. ToolsSonic supports four modes: Dialect default (backticks for MySQL, square brackets for SQL Server, double-quotes for everything else), Double quotes, Backticks, Square brackets, and None (review) — which emits bare identifiers and shows a warning for unsafe names.
String values are wrapped in single quotes, and any apostrophe inside a value is doubled (replaced with two consecutive single quotes, per the SQL standard). For example, the value O'Reilly becomes 'O''Reilly' in the generated SQL. This is correct for all six supported dialects. The converter does not use backslash escaping.
When the Infer numbers, booleans, NULL tokens option is enabled, the converter checks each cell value before wrapping it in single quotes. Cells that look like integers or decimals are emitted as bare numeric literals. Cells with the value true or false (case-insensitive) are emitted as TRUE or FALSE. Cells with the value NULL or \N are emitted as SQL NULL. You can disable inference to emit all non-empty values as quoted strings.
Empty cells have two policy options. SQL NULL emits the SQL keyword NULL for any cell that is empty after trimming. Empty string emits '' (two consecutive single quotes) to insert an empty string literal. Choose NULL for optional fields and columns that distinguish between missing and empty. Choose Empty string for required text columns that should never be NULL.
Batch size controls how many data rows appear in a single INSERT statement. One INSERT per row is the most portable and easiest to debug. Up to 25 rows and Up to 100 rows produce multi-row INSERT statements that are faster for bulk inserts in most databases. All rows puts every data row into one statement. Batch INSERT is supported by all six dialects but some databases impose limits on statement size.
Yes. Enter a schema name in the Schema field and a table name in the Table name field. ToolsSonic quotes each segment of the qualified path separately, producing output like "public"."users" for PostgreSQL or [dbo].[orders] for SQL Server. Leave the Schema field empty to use an unqualified table name.
Yes. The parser is quote-aware and follows RFC 4180 conventions. It handles commas inside double-quoted fields, embedded newlines inside quoted fields, and escaped double-quotes written as two consecutive double-quotes. It reports unclosed quoted fields and inconsistent row widths as warnings in the generation review panel.
The Auto-detect mode scans the first 20 lines of the input and scores four candidates: comma, tab, semicolon, and pipe. Whichever delimiter appears most frequently (outside quoted fields) is selected. You can also choose a delimiter manually: Comma (standard CSV), Tab (TSV), Semicolon (European CSV locales), or Pipe (log files).
No data is uploaded. CSV parsing and SQL generation run entirely in browser memory using vanilla JavaScript. There is no fetch() call, no XMLHttpRequest, no sendBeacon, no localStorage write, and no sessionStorage write. Closing the tab clears every byte of your data. This makes ToolsSonic safe for internal customer data, financial exports, and confidential database seeds.
No. The tool generates SQL text only. It never connects to a database, never executes SQL, never validates your schema or constraints, and never checks for duplicate rows or constraint violations. Generated SQL must be reviewed and run by you in your own database environment using a database client, migration tool, or script runner.
The Parsed data preview renders up to 20 data rows (excluding the header) as an HTML table so you can visually confirm that the parser correctly identified delimiters, quoted fields, and column alignment before generating SQL. It is not a database query result — it shows what the CSV parser read from your input.
The generation review panel shows a green Ready status and a summary of rows and columns when generation succeeds without warnings. When warnings occur, it shows a yellow Review status and a list of issues: unclosed quoted fields, inconsistent row widths, unsafe identifier names in None quoting mode, missing table name, and non-standard table name characters.
Paste TSV data (tab-separated) into the input panel. Set Input delimiter to Auto-detect or Tab (TSV) manually. The rest of the workflow is identical to CSV — set the table name, dialect, and batch size, then click Generate SQL. Tab characters inside quoted TSV fields are handled correctly by the parser.
Yes. Select MySQL from the SQL dialect dropdown. The converter automatically uses backtick identifier quoting for column names and table names. For example, a column named order becomes `order` in the generated SQL. You can also set the identifier quoting mode manually to Backticks on any other dialect.
Select PostgreSQL from the SQL dialect dropdown. Set the table and column names, then set Batch size to Up to 25 rows, Up to 100 rows, or All rows. PostgreSQL supports multi-row INSERT with a single INSERT INTO ... VALUES (...), (...), (...) syntax, which is what ToolsSonic generates.
The statistics strip shows seven values: Data rows (rows after the header), Columns (header field count), INSERT statements (number of generated statements), Values (rows × columns), SQL bytes (size of the generated SQL), Inferred literals (how many values were emitted as numbers, booleans, or NULL rather than strings), and Warnings (total diagnostic count).
Yes. Click Download .sql to save the generated SQL as a file named after your table name, for example users.sql. The file uses UTF-8 encoding. Copy SQL copies the output to the clipboard. Both actions happen in the browser with no server involved.
What is CSV to SQL INSERT?
What Is a CSV to SQL INSERT Generator?
A CSV to SQL INSERT generator reads CSV or TSV data and produces SQL INSERT statements ready to paste into a database client, migration script, seed file, or test fixture. It handles the messy reality of real CSV data: quoted commas, embedded newlines, apostrophes in text, empty cells that should be NULL, numeric-looking strings that should stay numeric, and dialect-specific identifier quoting.
Writing INSERT statements by hand from a CSV export is error-prone and time-consuming. Apostrophes must be doubled. Column names with spaces or reserved words must be quoted differently for MySQL, SQL Server, and PostgreSQL. Multi-row batches require a specific syntax. One inconsistency silently corrupts a column or breaks the SQL parser. ToolsSonic automates all of this — parsing the CSV correctly, choosing the right identifier quoting for your database, escaping string literals, and generating correct multi-row batches in one step.
Six SQL Dialects, Four Identifier Quoting Modes, and Full Type Inference
Dialect-aware quoting. Database engines disagree on how to quote identifiers containing reserved words, spaces, or special characters. MySQL uses backticks: column. SQL Server uses square brackets: [column]. PostgreSQL, SQLite, Oracle, and the SQL standard use double-quotes: "column". ToolsSonic applies the correct default for your chosen dialect and lets you override it when you need non-standard quoting in a migration script or stored procedure.
Schema-qualified table paths. Production databases rarely use bare table names. PostgreSQL uses public.users, SQL Server uses dbo.orders, Oracle uses HR.EMPLOYEES. ToolsSonic quotes each segment of a qualified path separately — so public.users becomes "public"."users" for PostgreSQL and [public].[users] for SQL Server.
Heuristic type inference. When inference is enabled, cells that look like integers or decimals are emitted as SQL numeric literals (no quotes). Cells with the value true or false are emitted as TRUE or FALSE. Cells with the value NULL or \N are emitted as NULL. This prevents the common mistake of inserting numeric identifiers and scores as quoted strings when the column type is INT or DECIMAL. You can disable inference to emit all non-empty values as quoted strings for strict type control.
Apostrophe escaping. Every string value passes through a single-quote doubler: O'Reilly becomes 'O''Reilly'. This is the standard SQL escaping method and works correctly in all six supported dialects. No backslash escaping is used, which would break on databases that interpret backslash sequences differently.
What Competitors Miss — and What ToolsSonic Does Better
ConvertCSV CSV-to-SQL is the most-visited tool in this category. It generates INSERT statements but uses a server for conversion, offers no dialect selection, and provides no visible parsing diagnostics. A malformed CSV row may produce silently wrong SQL.
SQLizer accepts CSV uploads and runs server-side schema detection. It infers column types aggressively and attempts to create a CREATE TABLE statement alongside the INSERTs. This is powerful but requires uploading your data to an external server, which is inappropriate for customer data, financial exports, and internal seeds.
Code Beautify CSV to SQL offers a simple client-side converter with no dialect selection, no identifier quoting control, no NULL policy, no batch sizing, and no diagnostics. It works for simple cases but produces incorrect SQL for names with reserved words or apostrophes in text values.
TableConvert provides a broad conversion matrix but its CSV-to-SQL mode has no batch INSERT support, no explicit NULL policy, no schema-qualified path support, and no visible parsing warnings.
ToolsSonic differentiates on four axes: First, it is entirely private — no upload, no server, all processing in the browser using vanilla JavaScript. Second, it provides explicit, configurable controls for every aspect of the SQL generation: dialect, identifier quoting, table path, delimiter, header detection, empty-cell policy, type inference, batch sizing, and trailing semicolons. Third, it shows a parsed-row preview so you can verify the parser read your CSV correctly before generating SQL. Fourth, it reports actionable warnings — unclosed quoted fields, inconsistent row widths, unsafe identifier names — that silent converters suppress.
Common use cases
- Generating INSERT seed data for a new database from a spreadsheet export
- Creating test fixtures for an integration test suite from CSV sample data
- Converting a CSV data migration file into batched INSERT statements for a production import
- Generating MySQL INSERT statements with backtick-quoted column names from a CSV export
- Producing PostgreSQL multi-row INSERT batches for a seed script or Flyway migration
- Converting TSV data from a database export tool into SQL INSERT statements
- Creating SQL INSERT statements for SQLite from CSV fixtures in a mobile app project
- Generating schema-qualified INSERT statements for a SQL Server or Oracle schema migration
Why use ToolsSonic's CSV to SQL INSERT?
ToolsSonic's CSV to SQL INSERT Generator is the only browser-based tool that combines all seven capabilities in one place: dialect-aware identifier quoting (MySQL backticks, SQL Server brackets, PostgreSQL/Oracle/SQLite/Generic double-quotes); schema-qualified table paths with per-segment quoting; RFC 4180 quote-aware parsing with embedded-newline and escaped-quote support; explicit type inference for numbers, booleans, and NULL/\N tokens (toggleable); configurable empty-cell policy (NULL or empty string); batch INSERT sizing (1/25/100/all rows); and complete privacy — no upload, no server, no fetch(), no localStorage, no data persistence of any kind.
Every competitor either requires a server upload (SQLizer, ConvertCSV), lacks dialect controls (Code Beautify), lacks NULL/type policies (TableConvert), or lacks parsing diagnostics (all of the above). ToolsSonic gives you every knob and shows you exactly what the parser found — so you can generate correct SQL the first time, not after debugging a production import.
SQL Dialect Reference — Identifier Quoting by Database
| Dialect | Identifier quote char | Example | Escape embedded quote |
|---|---|---|---|
| Generic SQL | `"` double-quote | `"order"` | Double it: `"or""der"` |
| PostgreSQL | `"` double-quote | `"public"."users"` | Double it: `"or""der"` |
| MySQL / MariaDB | `\`` backtick | `\`order\`` | Double it: `\`or\`\`der\`` |
| SQLite | `"` double-quote | `"column"` | Double it: `"or""der"` |
| SQL Server / T-SQL | `[` and `]` | `[dbo].[orders]` | Double the `]`: `[or]]der]` |
| Oracle | `"` double-quote | `"HR"."EMPLOYEES"` | Double it |
ToolsSonic CSV to SQL vs Competitors
| Feature | ToolsSonic | ConvertCSV | SQLizer | Code Beautify | TableConvert |
|---|---|---|---|---|---|
| Browser-only, no upload | ✅ | ❌ Server | ❌ Upload | ✅ Partial | ⚠️ Partial |
| SQL dialect selection | ✅ 6 dialects | ❌ | ✅ | ❌ | ❌ |
| Identifier quoting control | ✅ 4 modes | ❌ | ✅ | ❌ | ❌ |
| Schema-qualified table path | ✅ | ❌ | ✅ | ❌ | ❌ |
| RFC 4180 quote-aware parsing | ✅ | ✅ | ✅ | ⚠️ | ✅ |
| Apostrophe SQL escaping | ✅ Doubled | ✅ | ✅ | ⚠️ | ✅ |
| Type inference (numbers/bool/NULL) | ✅ Toggleable | ❌ | ✅ | ❌ | ❌ |
| Explicit NULL / empty-string policy | ✅ | ❌ | ✅ | ❌ | ❌ |
| Batch INSERT sizing | ✅ 1/25/100/all | ❌ | ❌ | ❌ | ❌ |
| Parsed table preview | ✅ | ❌ | ❌ | ✅ | ✅ |
| Row-shape diagnostics | ✅ | ❌ | ❌ | ❌ | ❌ |
| Dark mode | ✅ | ❌ | ❌ | ❌ | ❌ |
| Session history | ✅ 8 entries | ❌ | ❌ | ❌ | ❌ |
Related tools
CSV to JSON Converter
Editor's choiceConvert CSV to clean JSON locally. Parse quoted fields, commas, tabs, semicolons, duplicate headers, numbers, booleans, nulls, nested dot keys, keyed objects, column arrays, or JSON Lines, then copy or download the result.
CSV Viewer
Editor's choiceView CSV and TSV files as a fast, searchable, sortable table. Detect delimiters, inspect columns, filter rows, sort mixed data, toggle columns, paginate large previews, and export selected rows locally.
CSV Formatter
Editor's choiceFormat CSV and TSV locally with quote-aware parsing, delimiter conversion, 4 quoting modes, CRLF/LF control, row-shape diagnostics, table preview, and clean download — no upload.
SQL Formatter
Editor's choiceFormat, beautify, and minify SQL in your browser — 10 dialects, heuristic lint hints, keyword casing, protected strings, statement splitting, diagnostics, and session history. No upload, no execution.