Inline SQL Variables

Substitute bound parameters (?, :name, $1) into a SQL string.

The Inline SQL Variables tool replaces placeholders such as ?, :name and $1 in a SQL statement with the actual values, so you can read or paste the final query while debugging. It handles quoting and escapes single quotes in strings. It never runs the SQL.

What are SQL placeholders and why inline them?

Applications normally send SQL and its values separately. The statement contains placeholders and the driver binds the values on the database side. Placeholder styles differ: question marks are positional in MySQL and SQLite drivers, $1, $2 are numbered in PostgreSQL, and :name is a named style used by several libraries. This keeps data out of the SQL text, which is how SQL injection is prevented. Query logs often show the statement and its parameters apart, which makes the query hard to read or to try in a console. Inlining puts the values back in place, quoting strings, writing NULL and TRUE or FALSE, and doubling any single quote inside a string. The output is for reading and debugging only. Never build production queries by pasting values into SQL text.

How to use Inline SQL Variables

  1. Paste the SQL Enter the statement with its placeholders in the SQL with placeholders box.
  2. Add the parameters Fill the Parameters box with a JSON array or object, or with one value per line.
  3. Read the result The SQL with values inlined box updates as you type, and a message tells you how many placeholders were replaced.
  4. Check warnings Any yellow warning means a placeholder had no value or some values were not used. Fix the input and compare again.

Frequently asked questions

Can I run the resulting SQL in production?

Do not do that with untrusted input. The output is for reading and debugging. Use parameterised queries in application code so the database binds values safely.

Does this tool execute the query?

No. It only rewrites text and never connects to a database.

How are objects and arrays in the parameters rendered?

Values that are objects or arrays are written as JSON text inside single quotes. Check whether your column type accepts that form.

What about dates?

A date in the parameters is just a string, so it is quoted as a string. Cast it yourself if the database requires it.

Are my queries sent anywhere?

No. Everything is processed in the page and your SQL and values stay on your device.