Paste SQL on the left and click "Convert" — we will turn it into XMLPaste SQL

What this tool does

If you have ever had to dump a bunch of database rows into an XML file for a vendor, a legacy SOAP endpoint, or an old ETL job that still expects XML, you know the drill — open a query tool, run the SELECT, export, hand-massage the output, fight with date formats. Paste your SQL here instead and you get back well-formed XML in one pass. Multi-row INSERT statements, schema-only CREATE TABLE, or a mix of both — same result.

The converter reads the SQL the way a database would. Each row in a multi-row INSERT becomes one element, and each column becomes a child element named after the column. NULL values become empty elements (so the shape of every row stays the same). Date-ish literals — '2024-01-15 10:30:00', DATE '2024-01-15', or raw timestamps — are emitted as ISO-8601 strings, so downstream parsers in Java, .NET, Python, or anywhere else will read them back with zero fuss. Numeric types keep their precision; booleans come through as true/false.

Schema-qualified names like public.orders or dbo.Orders get stripped down to just orders or Orders in the element name, because XML element names cannot contain dots. Quoted identifiers, backticks from MySQL, and double-quoted names from PostgreSQL are handled the same way. Drop in a CREATE TABLE and you get an XML skeleton for that schema — one empty element per column, useful for building a starter XSD or a sample payload. Several tables in the same query? Each one lands in the output as its own section, in order.

How to use it

Three steps. Works the same whether you paste one row or a thousand.

1

Paste your SQL (or try the sample)

Drop the SQL into the left editor as-is. INSERT statements with one row or many, CREATE TABLE definitions, or a mix — all fine. Click Load Sample if you want to see what a realistic multi-table order dump looks like.

Comments (-- and /* ... */), schema prefixes, dialect-specific quoting (MySQL backticks, SQLite double quotes, SQL Server square brackets), and trailing semicolons all work fine — no need to clean anything up.

2

Hit Convert

Click the green Convert button. The tool parses the SQL, expands every row of a multi-row insert, normalises dates and booleans, and builds the XML in one pass. A short loading indicator shows while it runs.

3

Copy the XML

The right panel fills with indented, well-formed XML that any standards-compliant XML parser will accept. Copy it straight into a SOAP body, a test fixture, an ETL drop folder, or wherever you need it.

When this actually comes in handy

Database seed fixtures

You have a pile of <code>INSERT</code>s from a seed script and you need the same data as XML for an integration test or a mock server. Paste the inserts, take the XML, done — no hand-editing per row.

SOAP and legacy enterprise integration

An older partner system expects an XML body that mirrors a set of database rows. Skip the middle-layer code that stringifies rows one by one; paste the INSERT directly and copy the XML into your SOAP request.

Audit and compliance exports

Regulators and auditors still love XML. Turn the rows you just INSERTed (or the ones you captured from a log query) into a signed, archivable XML document without standing up an export pipeline.

XML-based ETL pipelines

Feeding an ETL tool like SSIS, Informatica, or a home-grown XSLT pipeline? Convert the upstream SQL sample into XML to prototype the transform before the real batch job is wired up.

Common questions

How does it handle multi-row INSERT statements?

A multi-row INSERT INTO orders (...) VALUES (...), (...), (...); becomes one container element for the table, with one child element per row — each child named after the singular form of the table (so orders rows become <order> elements inside an <orders> wrapper). Every row has the same column children, in the same order as the column list, so the output stays predictable even if you have hundreds of rows.

What happens to NULL values?

A NULL in the values list becomes an empty element (e.g. <middle_name/>) rather than being dropped. That keeps the shape of every row identical, which matters for downstream consumers that iterate columns positionally or build an XSD from the sample. If you need xsi:nil="true" instead, wrap the output in a tiny XSLT or post-process — the converter sticks to plain empty elements for portability.

Are dates and timestamps formatted as ISO-8601?

Yes. SQL literals like '2024-01-15 10:30:00', DATE '2024-01-15', TIMESTAMP '2024-01-15 10:30:00+00', and MySQL-flavoured '2024-01-15T10:30:00' all come out as ISO-8601 strings (2024-01-15T10:30:00Z where a timezone is present, or a plain 2024-01-15T10:30:00 otherwise). That is the format every major language's XML stack parses cleanly.

Can I paste just a CREATE TABLE — no rows?

Yes. A schema-only CREATE TABLE produces an XML skeleton: one element per column, empty, in the order the columns were declared. It is a handy starting point for a sample payload, an XSD draft, or a test fixture that you fill in by hand. Data types in the CREATE TABLE are read for hints (dates stay dates, numerics stay numerics) but the empty elements do not carry type info in the output.

What if my query has several tables in it?

Each INSERT or CREATE TABLE statement produces its own top-level section in the output, in the order you wrote them. A mixed script that creates orders, inserts three orders, then inserts six order_items becomes a document with three table sections, each wrapped in a container element. The parser does not try to join or relate them — it just preserves the structure you pasted.

Does it strip schema prefixes like public.orders or dbo.Orders?

Yes. XML element names cannot contain dots, so public.orders becomes <orders>, dbo.Orders becomes <Orders>, and my_schema."User Table" becomes <User_Table> (spaces turn into underscores because XML names cannot contain spaces either). MySQL backticks, PostgreSQL double quotes, and SQL Server square brackets are all stripped the same way.

Other tools you may need

SQL to XML is one piece of the puzzle. These pair well with it: