ASA SQL Reference
SQL Statements
Use this statement to export data from a database into an external ASCII-format file.
UNLOAD select-statement TO filename-string [ unload-option ... ]
unload-option :
APPEND {ON|OFF}
| DELIMITED BY string
| ESCAPE CHARACTER character
| ESCAPES {ON | OFF}
| FORMAT {ASCII | BCP}
| HEXADECIMAL {ON | OFF}
| QUOTES {ON | OFF}
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 [Interactive SQL].
The UNLOAD statement allows the result set of a query to be exported to a comma-delimited file. The result set is not ordered unless the query itself contains an ORDER BY clause.
When unloading result set columns with binary data types, UNLOAD writes hexadecimal strings, of the form \xnnnn where n is a hexadecimal digit.
For a description of the unload-option parameters, see UNLOAD TABLE statement.
When unloading and reloading a database that has proxy tables, you must create an external login to map the local user to the remote user, even if the user has the same password on both the local and remote databases. If you do not have an external login, the reload may fail because you cannot connect to the remote server.
For more information about external logins, see Working with external logins.
When the APPEND option is ON, unloaded data is appended to the end of the file specified. When the APPEND option is OFF, unloaded data replaces the contents of the file specified. This option is OFF by default.
The permissions required to execute an UNLOAD statement are set on the database server command line, using the -gl
option.
For more information, see -gl server option.
None. The query is executed at the current isolation level.
OUTPUT statement [Interactive SQL]
SQL/92 Vendor extension.
SQL/99 Vendor extension.
Sybase UNLOAD is not supported by Adaptive Server Enterprise.