About the SQL Unescape
Text copied from a SQL script or a database dump carries the literal escaping: every apostrophe appears twice. This tool collapses each pair back to one, which is the exact inverse of the SQL Escape tool and of what the database does when it reads the literal.
Doubling is the only escape the SQL standard defines for a string literal, and it behaves identically in MySQL, PostgreSQL, SQL Server, Oracle and SQLite, so the conversion needs no dialect setting. Two quotes collapse to one, four collapse to two, and inside a well-formed literal the run length is always even. An odd run means the text was cut off mid-value or was never a complete literal, and the leftover quote is left visible rather than quietly discarded.
Surrounding quotes are not stripped automatically, because a value might legitimately start or end with an apostrophe; remove them yourself if you pasted a complete literal. Backslash escapes are left as they are, since only MySQL and MariaDB in their default mode treat a backslash as special, and PostgreSQL does so only inside an E'' string.
The everyday case is lifting one long text value out of a dump, a product description or an embedded JSON blob, so it can be read or diffed. For a whole dump, the SQL to JSON converter unescapes every value as it parses the INSERT statements, and SQL Escape puts the doubling back when the value has to go into a query again.
How to use
- Paste the escaped text.
- Copy the plain text.
- Remove the outer quotes if you included them.
Common questions
- Does it handle MySQL backslash escapes?
- No. Only doubled single quotes are unescaped. Use a text replace for \' if needed.
- Are the surrounding quotes removed?
- No. Paste only the contents of the literal, or delete the outer quotes afterwards.
- Can it decode a whole INSERT statement?
- Use SQL to JSON or SQL to CSV for that; this tool works on a single value.