SQL Escape
Escape apostrophes for a SQL string literal by doubling them. Runs in your browser; nothing is uploaded.
What escaping SQL does
Every apostrophe is doubled, which is how standard SQL writes an apostrophe inside a string literal. The output is the body of the literal; add the surrounding quotes yourself. This is the standard form, which PostgreSQL, SQL Server, Oracle and SQLite all accept; MySQL also accepts a backslash escape, but a backslash is a literal backslash on the other engines, so emitting it would produce a statement that fails halfway across a schema.
How to use it
SQL Escape: paste the text into the box above, and press Run to get the escaped SQL below.
Worked example
Input:
O'Brien said 'hi'
Output:
O''Brien said ''hi''
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns escaped SQL; reloading the page discards both.
Every apostrophe is doubled, which is how standard SQL writes an apostrophe inside a string literal. The output is the body of the literal; add the surrounding quotes yourself. This is the standard form, which PostgreSQL, SQL Server, Oracle and SQLite all accept; MySQL also accepts a backslash escape, but a backslash is a literal backslash on the other engines, so emitting it would produce a statement that fails halfway across a schema.
Escape apostrophes for a SQL string literal by doubling them. Runs in your browser; nothing is uploaded.
How to use it
SQL Escape: paste the text into the box above, and press Run to get the escaped SQL below.
Why it runs in your browser
The conversion happens on this page with JavaScript. Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere. The page reads text and returns escaped SQL; reloading the page discards both.
What to Expect
Best for
- Converting text to escaped SQL when the data is already on screen.
What this tool keeps
- Your input is not posted to a server, so it works offline after the page loads and nothing is retained anywhere.
Sample input
O'Brien said 'hi'
Sample output
O''Brien said ''hi''
Frequently asked questions
How do I use the sql escape?
SQL Escape: paste the text into the box above, and press Run to get the escaped SQL below.
Is my input uploaded?
No. The text is parsed on this page with JavaScript and is never posted to a server.
Is there a size limit?
Yes: 5 MB per run. Larger input is refused with a message rather than freezing the tab.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.