Chapter 9 SQL Statements
635
UNLOAD TABLE statement
Use this statement to export data from a database table into an external
ASCII-format file.
UNLOAD [ FROM ] TABLE [
owner.
]
table-name
… TO '
filename
-
string
'
[
unload-option
… ]
unload-option
:
DELIMITED BY
string
| ESCAPE CHARACTER
character
| ESCAPES {ON | OFF}
| FORMAT {ASCII | BCP}
| HEXADECIMAL {ON | OFF}
| ORDER {ON | OFF}
| QUOTES {ON | OFF}
The permissions required to execute an UNLOAD statement are set on the
database server command line, using the –gl command-line option.
$ For more information, see "–gl command-line option" on page 27.
None.
"LOAD TABLE statement" on page 560
"OUTPUT statement" on page 573
"UNLOAD statement" on page 634
The UNLOAD TABLE statement allows efficient mass exporting from a
database table into an ASCII file. UNLOAD TABLE is more efficient than
the Interactive SQL statement OUTPUT, and can be called from any client
application.
UNLOAD TABLE places an exclusive lock on the whole table.
When unloading columns with binary data types, UNLOAD TABLE writes
hexadecimal strings, of the form \xnnnn where n is a hexadecimal digit.
For descriptions of the FORMAT, DELIMITED BY, and ESCAPE
CHARACTER options, see "LOAD TABLE statement" on page 560.
filename-string The filename to which the data is to be unloaded.
Because it is the database server that executes the statements, filenames
specify files on the database server machine. Relative filenames specify files
relative to the database server's starting directory. To unload data onto a
client machine, see "OUTPUT statement" on page 573.
Function
Syntax
Permissions
Side effects
See also
Description
Parameters