Want to export data from DB2 query result to HTML using current date as file name?
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 DB2 query result to HTML file using dynamic filename with date and time
Login to DB2 -> Enter DB2 SQL statement -> Set HTML filename template including date -> Export DB2 query to HTML using current date as file name
Choose DB2 and logon.

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

Select HTML file type.

1. Enter DB2 SQL query.

2. Set HTML file options. Enter filename template, including date, #yyyy# is for current year, #mm# month, #dd# day, #hh# hour, #mi# minute, #ss# second.

3. Set rows options.

4. Export DB2 query results to HTML file. Dynamically created HTML file name using present system time.

After exporting, you can view output HTML files.

More about DB2 to HTML converter
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.
