Exporting query results to a file
You can export query results data to a file system using the Export Query Results wizard.
Before you begin
To export a query result set to Microsoft Excel correctly, start each Excel formula with “=” in the query.
SELECT 45.5 AS PRODPRICE, 30 AS AMOUNT, '=A2*B2' AS PRICE FROM SYSIBM.SYSDUMMY1
To save query results to a file:
About this task
- Open the Export Query Results wizard
in one of the following ways:
- With a query result set opened in the editor, select Select page of the Export wizard, and then select Result set from the list of available export wizards. to open the
- With a query result set opened in the editor, click the Export toolbar button.
From the Source list, select the query result set that you want to
Note: If the query that you are exporting includes several result sets, all of them are displayed in the Source field. Also, if the query includes several result sets, all of them can be exported into one
- If you are
using QMF for Workstation,
specify a name for the file that you are creating in the File
By default, the file is saved in your home directory.
- Specify the type of file that you will be creating. Select
from the list of available file types in the Export type field.
You can choose one of the following file types:
Note: Some of the fonts (for example, TTC) can be displayed incorrectly in PDF files.
- Avro (*.avro)
- Parquet (*.parquet)
- PDF (*.pdf)
- CSV (*.csv)
- IXF (*.ixf)
- XML QMF Markup Language file (*.xml)
- HTML (*.htm)
- TEXT (*.txt)
- dbase III (*.dbf)
- XLS Microsoft Excel 97-2003 (*.xls)
- XLSX Microsoft Excel 2007 (*.xlsx)
- If you selected any option different form XLS or XLSX, click Next. The Second page of the Export Query Results wizard opens. On this page you can select additional options that are available depending on the type of file that you are creating. For example, the wizard brings up a box that allows you to enter options for those grayed out choices when you chose DATAFORMAT=TEXT.
If you selected IXF , dbase III, or
XML, after setting up the export options, click Next
to go the page where you can set up the columns of the exported result set.
Note: Click Finish to skip the next step and close the Export Query Results wizard.
You can set up the columns by using following options:
- In the Type column, select a data type from the list.
- In the Length field, specify a maximum number of characters in a string.
- In the Precision field, specify a maximum total number of digits for the
- In the Scale field, specify a maximum number of fractional digits for the
- Click Finish. If you are using QMF for Workstation, a save window specific to your operating system opens. If you are using QMF for WebSphere®, a save window opens that lists the available files for download. Click a hyperlink to download the file to your workstation.