Withdata Software

Convert XML to SQL

Want to convert XML file to SQL file?

If you want to import XML file to SQL Server, see this page: XML to SQL Server.

If you want to import XML file to SQLite, see this page: XML to SQLite.

Try Withdata Data File Converter, a desktop XML to SQL converter for Windows, MacOS, and Linux, Convert XML to SQL, Easy and Fast.

Download Withdata DataFileConverter
Windows 64 bit
Windows 32 bit
Linux .deb (For Debian, Ubuntu) 64 bit
Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit
MacOS 64 bit

Convert XML to SQL

Choose XML file -> Set SQL file -> Convert XML to SQL

“Start a New Convert” for “XML to SQL”.

Select From “File” “XML” To “File” “SQL”.

1. Open source XML file.

Support large XML file ( > 4GB ).

Source XML file’s content is like this:

2. Config target SQL file.

3. Set rows options.

4. Convert XML to SQL.

After converting, you can view the output SQL file.


More about XML to SQL converter

See Video: Convert XML file to SQL file without coding

See also:

XML → SQL reference

Type mapping

Value kindin XMLin SQL
Int<int>1234</int>INT
Bigint<bigint>9007199254740993</bigint>BIGINT
Decimal<decimal>1234.56</decimal>DECIMAL(p,s)
Float<float>1.234e10</float>DOUBLE PRECISION
Text<char>text</char>VARCHAR(n)
Long text<text>multi-line text</text> (entities for &amp; &lt;)TEXT / CLOB
Date<date>2026-09-18</date> (xs:date with an XSD)DATE
Datetime<datetime>2026-09-18T14:30:00Z</datetime> (xs:dateTime)TIMESTAMP
Binary<blob>base64...</blob> (xs:base64Binary)BLOB / BYTEA
Boolean<bool>true</bool>BOOLEAN / SMALLINT
JSONescaped inside an element, or its own sub-treeJSON / TEXT

Dialect differences

Both XML and SQL are file formats, so what differs below is how each one chooses to represent a value.

Propertyin XMLin SQL
identifiersAttribute values in quotes; entities (&amp; &lt; &gt;) for ...Two competing conventions: single-quoted literals and diale...
datesText (xs:date / xs:dateTime when an XSD is in play)Depends on the dialect: DATE literals, TO_DATE(), or plain ...
binarybase64Binary / hexBinary inside textDialect-specific: X-quoted literal, 0x hex, or decode()
separatorTags, not delimitersStatement terminators (;)
encodingDeclared in the XML declarationNo declaration
typingNone in the markup itselfTypes belong to the target database, and they differ betwee...
shapeArbitrary treeStatements; a dump usually means CREATE TABLE plus INSERT rows
ceilingWhole document is usually parsed into memoryNo formal limit, but a single INSERT statement has to fit i...

Do it online, free

Skip the manual work — convert XML to SQL online, free (runs in your browser, nothing is uploaded). For large files or batch jobs, use the desktop apps.