araç köşesi

SQL INSERT to CSV

Pull the table back out of the INSERT statements in an SQL dump; MySQL, PostgreSQL and SQL Server syntax is recognized, output as CSV or JSON

Your data stays with you. Conversion happens inside the browser; nothing is sent to a server.

How it works

You usually reach for this when all you have is a database backup (.sql file): the member list of an old site, the orders table of a retired store, or sample data a developer sent over. To see the table without installing a database, open the file in Notepad or TextEdit and paste the INSERT lines, or the whole file, into the left pane. "INSERT INTO customers (id, name) VALUES (1, 'Emily'), (2, 'Daniel');" becomes a two-row table with id and name columns. mysqldump and pg_dump do not write column names into their INSERTs; the tool takes them from the CREATE TABLE statement in the same dump, and falls back to column1, column2 if there is none. Text values lose their quotes: 'O''Brien' and MySQL's 'O\'Neil' become O'Brien and O'Neil, and NULL becomes an empty cell. Functions like NOW() are not run; they are copied as written and counted in the result line. With several tables, each one downloads as its own CSV inside a single ZIP; choose JSON and the table names become keys. A SELECT query cannot be run, because there is no database here; only values written in the text are extracted.

This tool is also known as sql to csv, sql to csv converter, convert sql insert to csv, sql dump to csv, sql to json.

What is SQL INSERT?

INSERT is the SQL statement that adds rows to a database table: INSERT INTO table (column1, column2) VALUES (value1, value2). One statement can hold many rows separated by commas. Database backups (mysqldump, pg_dump --inserts, SQL Server's Generate Scripts) write a table's contents out as these statements, so INSERT lines are the table itself in text form and can be read without a database.

What is SQL dump (.sql)?

An SQL dump is a plain-text file of the commands needed to rebuild a database: first CREATE TABLE defines the tables, then INSERT or COPY adds the rows. The export button in a hosting control panel and phpMyAdmin both produce this file. It can be large, but it is text; to get a single table, paste just that table's part of the file.

What is the difference between an SQL dump and a CSV file?

An SQL dump is a set of commands for a database: it carries the table's structure (column types, keys), its contents and several tables together, but you need a database, or a reader like this one, to open it. A CSV carries only the values of one table, with no types, keys or table name, yet every program, Excel included, opens it directly. Use SQL to restore a backup, and CSV to look at the data, share it or move it into another system.

Which SQL dialects are recognized

Databases quote the same things differently. MySQL wraps table and column names in `backticks`, PostgreSQL in "double quotes" and SQL Server in [square brackets]; all three are recognized and the names come out bare. Text values sit in single quotes everywhere, and a single quote inside is doubled ('O''Brien'). MySQL also uses backslash escapes: \' is a quote and \n a line break. In PostgreSQL a backslash is an ordinary character, so C:\temp must stay as it is. The tool tells a MySQL dump from its traces (backticks, ENGINE=, LOCK TABLES) and treats backslashes as escapes only there; the result line says when it did.

PostgreSQL's default pg_dump output uses a COPY block instead of INSERTs: after the line "COPY public.products (id, name) FROM stdin;" come tab-separated rows and a closing \. line. That block is read too, and \N becomes an empty value. SQL Server's N'text' prefix, PostgreSQL's '2026-09-27'::date cast and MySQL's _utf8mb4'text' prefix are removed and the value is kept.

  • `name`, "name", [name] → name
  • 'O''Brien', 'O\'Neil' (MySQL) → O'Brien, O'Neil
  • NULL → empty cell (null in JSON)
  • 1250.50 → 1250.50, exactly as written
  • NOW(), CAST(…) → not run, written as text

CSV or JSON, and which separator

Choose CSV to look at the table in Excel or load it into another system. English Excel expects commas, so the comma is the default; a value that contains a comma, like "Clark, Ortiz & Co.", is put in quotes. SQL decimals use a dot (1250.50) and the tool leaves them as they are, which English Excel reads as numbers (in General format it shows 1250.5). Excel set to a European or Latin American region expects semicolons and a decimal comma; pick the semicolon for those users and note that they may see 1250.50 as text. The downloaded CSV starts with a UTF-8 BOM, so accented letters such as é or ñ display correctly in Excel.

Choose JSON when the data goes to a program or a web page: numbers are written without quotes, NULL as null and TRUE/FALSE as true/false, and the digits stay as written (1250.50 is 1250.50 in the JSON too). A pg_dump COPY block carries no types; the tool reads each column's type from CREATE TABLE and turns integer and numeric columns into numbers and the t/f values of a boolean column into true/false.

Frequently asked questions

How do I convert an SQL file to CSV?

Open the .sql file in Notepad, TextEdit or any text editor, copy its contents and paste them into the left pane on this page. The values in the INSERT statements become a table, shown as CSV on the right; click Download to get the .csv file. If the dump holds several tables, each one comes as its own CSV inside one ZIP file.

Can I export the result of a SELECT query to CSV here?

No. This page does not connect to a database and does not run queries; it only reads values written in the text. To get SELECT results, run the query in your own database tool and export from there. If you have a backup file with INSERT statements, this tool pulls the table out without installing a database.

Why are my columns named column1, column2?

When an INSERT has no column list (INSERT INTO customers VALUES (…)), the names only exist in the table definition. If the same text contains CREATE TABLE customers, the tool takes the names from there; otherwise it numbers the columns. Paste the top part of the dump with the table definition as well and the real names appear.

Is my database backup sent to a server?

No. The SQL text is read inside your browser and the table is built there. Even a dump with customer details, email addresses or password hashes never leaves this page and is not saved anywhere.