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

What this tool does

A vendor wants yesterday's orders as an XML file, an old ETL job only reads XML, or a SOAP test needs a few realistic rows. You have the data as SQL already, usually a dump full of INSERT statements, and FOR XML or xmlagg is not available on the database you are stuck with. Paste the statements, press Convert, and our backend returns XML with an element per table, a separate element for each tuple in VALUES, and a child element per column.

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

Paste the dump, press Convert, take the XML. Here is how each step treats SQL in particular.

1

Paste your SQL (or try the sample)

Paste the SQL into the left editor. Load Sample loads two multi-row inserts, three rows into orders and three into order_items, with a commented-out CREATE TABLE above them. Comments, whether -- or /* */, are ignored, so that schema block does not affect the result.

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

Hit the green Convert button. The statements are posted to our backend, which splits every VALUES tuple into its own row, matches the values to the column list, rewrites TRUE/FALSE in lowercase and turns timestamp literals into ISO-8601 text. A "Converting..." overlay covers the editors while it runs. Nothing touches a database.

3

Copy the XML

Statements for two different tables, like the sample, come back inside one <Root> element with a child per table. Check the column values against your source, then save the file for the vendor drop folder or the test that expects it.

When this actually comes in handy

Database seed fixtures

You have a pile of INSERTs 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 named after the table, with one <row> child per VALUES tuple, so the rows of orders come out as <row> 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. The schema name is dropped and the element is named after the table alone, 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

For the same rows as JSON, or to read and validate the XML before it goes to the vendor, use these: