Convert SQL INSERT Statements to CSV
Paste one or more INSERT INTO statements and extract the data as a clean CSV. Column headers come from the INSERT column list. NULL becomes empty. Works in your browser.
SQL INSERT → CSV is coming soon. In the meantime, try the JSON → CSV converter, which has flattening built in.
How it works
Column headers from the INSERT column list
INSERT INTO table (col1, col2, col3) VALUES ... — the column list in parentheses becomes the CSV header row. If no column list is present, columns are named column1, column2, etc.
NULL becomes an empty field
SQL NULL values are converted to empty CSV fields — the standard representation for missing data in CSV. TRUE and FALSE are preserved as-is.
Multiple INSERT statements combined
Paste an entire SQL dump with multiple INSERT INTO statements. All rows are combined into a single CSV. Works with pg_dump, mysqldump, and hand-written SQL.
Example
pg_dump excerpt — extracting user records without running a SELECT
INSERT INTO users (id, username, email, plan, created_at) VALUES (1, 'alice_chen', 'alice@example.com', 'pro', '2024-01-15'), (2, 'bob_kumar', 'bob@example.com', 'free', '2024-02-01'), (3, 'sara_mills', NULL, 'enterprise', '2024-02-14');
id,username,email,plan,created_at 1,alice_chen,alice@example.com,pro,2024-01-15 2,bob_kumar,bob@example.com,free,2024-02-01 3,sara_mills,,enterprise,2024-02-14
sara_mills has NULL for email — it becomes an empty field in the CSV. Column names come from the INSERT column list.
Frequently asked questions
Can I use this with a mysqldump or pg_dump output?
Yes. Both mysqldump and pg_dump produce INSERT INTO ... VALUES statements that this converter handles. Paste the relevant INSERT blocks — you don't need to paste the entire dump file.
What happens if the INSERT statements don't have a column list?
If your INSERT uses INSERT INTO table VALUES (...) without naming columns, the converter generates placeholder headers: column1, column2, etc. You can rename them after opening the CSV.
Does this handle multi-row INSERT statements like INSERT INTO ... VALUES (1,...), (2,...)?
Yes. Multi-row INSERT statements (MySQL-style batched inserts) are fully supported. Each value group in parentheses becomes one CSV row.
What if my string values contain commas?
String values are single-quoted in SQL. The converter reads them as complete strings and applies RFC 4180 quoting in the CSV output — values with commas are wrapped in double quotes automatically.
Can I convert the CSV back to SQL?
Yes — use our CSV to SQL converter to generate INSERT statements from a CSV file. It handles type inference, NULL detection, and configurable table and column names.
Related Tools
All conversions run in your browser — nothing is uploaded.
Browse all 26 converters →