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 Download DataFileConverter

Convert XML to SQL

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

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

convert XML file to SQL file - task window

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

create SQL file by XML file - select type

1. Open source XML file.

Support large XML file ( > 4GB ).

transform XML file to SQL file - open a XML file

Source XML file’s content is like this:

XML to SQL converter - source XML file

2. Config target SQL file.

generate SQL file by XML file - config SQL file

3. Set rows options.

convert XML file to SQL file - summary

4. Convert XML to SQL.

convert XML file to SQL file - convert file

After converting, you can view the output SQL file.

convert XML file to SQL file - view 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.


Posted

in

by