Convert SQL INSERT to CSV

Pull the values out of a block of INSERT statements and get CSV rows back, for when a dump is all you have and you need the data in a spreadsheet.

Output

How to use

  1. Paste a block of INSERT statements.
  2. The values are parsed into rows.
  3. Copy or download the CSV.

Frequently asked questions

Where do the column names come from?

The column list in the INSERT statement. Statements written without one produce positional columns, since the names simply are not in the text.

Does it handle multi-row inserts?

Yes. An INSERT with several parenthesised value groups is expanded into one CSV row per group.

What happens to NULL?

It becomes an empty field, which is the CSV convention. That does mean a genuine empty string and a NULL look the same in the output.

Are escaped quotes handled?

Doubled single quotes inside a string are unescaped back to one, so O''Brien in the SQL comes out as O'Brien in the CSV.

Last updated

Powered by maratool