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.
- Can run in GUI mode, Step by Step, just a few mouse clicks.
- Can run in Command line, for Scheduled Tasks and Streams.
- Convert files locally and privately, avoid uploading large XML file(s) to online services.
- Support Windows, Linux, and macOS.
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
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
See Video: Convert XML file to SQL file without coding
See also:
XML → SQL reference
Type mapping
| Value kind | in XML | in 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 & <) | 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 |
| JSON | escaped inside an element, or its own sub-tree | JSON / TEXT |
Dialect differences
Both XML and SQL are file formats, so what differs below is how each one chooses to represent a value.
| Property | in XML | in SQL |
|---|---|---|
| identifiers | Attribute values in quotes; entities (& < >) for ... | Two competing conventions: single-quoted literals and diale... |
| dates | Text (xs:date / xs:dateTime when an XSD is in play) | Depends on the dialect: DATE literals, TO_DATE(), or plain ... |
| binary | base64Binary / hexBinary inside text | Dialect-specific: X-quoted literal, 0x hex, or decode() |
| separator | Tags, not delimiters | Statement terminators (;) |
| encoding | Declared in the XML declaration | No declaration |
| typing | None in the markup itself | Types belong to the target database, and they differ betwee... |
| shape | Arbitrary tree | Statements; a dump usually means CREATE TABLE plus INSERT rows |
| ceiling | Whole document is usually parsed into memory | No 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.