Want to export data from DB2 query to HTML file?
Try Withdata DBToFile, a DB2 to HTML converter for Windows, Linux, and macOS, Export DB2 data to HTML, 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.
- Support Windows, Linux, and macOS.
Export data from DB2 query to HTML table
Login to DB2 -> Enter DB2 query -> Set HTML file options -> Export DB2 query to HTML table
Choose DB2 and logon.

Click “Export From Query” for “DB2 to HTML”.

Select Html file type.

1. Enter DB2 query.

2. Set HTML file options.

3. Set rows options.

4. Export DB2 query results to HTML table.

After exporting, you can view output HTML table.

More about DB2 to HTML converter
See also:
- Export DB2 table to HTML
- Export multiple similar DB2 tables to one HTML file
- Batch export DB2 tables to HTML files
DB2 → HTML reference
Type mapping
| Value kind | in DB2 | in HTML |
|---|---|---|
| Int | INTEGER | <td>1234</td> |
| Bigint | BIGINT | <td>9007199254740993</td> |
| Decimal | DECIMAL(p,s) | <td>1234.56</td> |
| Float | DOUBLE | <td>1.234e+10</td> |
| Text | VARCHAR(n) | <td>text</td> |
| Long text | CLOB | <td>multi-line text</td> (entities for & <) |
| Date | DATE | <td>2026-09-18</td> |
| Datetime | TIMESTAMP | <td>2026-09-18 14:30:00</td> |
| Binary | BLOB | not representable in a cell |
| Boolean | SMALLINT | <td>true</td> |
| JSON | CLOB | <td>{"a":1}</td> (quotes escaped) |
Dialect differences
DB2 is a database server and HTML is a file format, so the gap is wider than a dialect difference – the rows below are where values and structure stop lining up.
| Property | in DB2 | in HTML |
|---|---|---|
| port | 50000 | — |
| identifiers | "double quotes" | Attribute values in quotes; entities for reserved characters |
| row limit | FETCH FIRST n ROWS | — |
| dates | DATE, TIME, TIMESTAMP | Whatever text was rendered |
| long text | CLOB | — |
| binary | BLOB | data: URIs inside src attributes |
| separator | — | Tags, not delimiters |
| encoding | — | Declared in a meta charset tag or the HTTP header |
| typing | — | None |
| shape | Tables of rows and columns | Free form; tables are row/column structures inside markup |
| ceiling | — | No formal limit |
Command line
| Side | Command |
|---|---|
| DB2 | EXPORT TO out.csv OF DEL |
| DB2 (load) | db2 IMPORT FROM file OF DEL |
Convert your data online, free
Free in-browser converters for CSV, Excel, JSON, XML and SQL: Withdata Online Data Conversion. Large files, batch conversion or scheduling? See the offline desktop apps, or browse all data conversion tools.
