You can export query results in Interactive SQL by using the UNLOAD statement.
Prerequisites
When unloading into a variable, no privileges are required. Otherwise, the required privileges depend on the database server -gl option, as follows:
If the -gl option is set to ALL, you must be the owner of the tables, or have SELECT privilege on the tables, or have the SELECT ANY TABLE system privilege.
If the -gl option is set to DBA, you must have the SELECT ANY TABLE system privilege.
If the -gl option is set to NONE, UNLOAD is not permitted.
When unloading to a file on a client computer:
You must have the WRITE CLIENT FILE privilege.
You must have write permissions on the directory where the file is located.
The allow_write_client_file database option must be enabled.
The write_client_file secure feature must be enabled.
Context and remarks
Use the BCP FORMAT clause to import and export files between SQL Anywhere and Adaptive Server Enterprise.
In the SQL Statements pane, execute an UNLOAD statement. For example:
UNLOAD SELECT * FROM Employees TO 'C:\\ServerTemp\\Employees.csv'; |
If the export is successful, the Messages tab displays the amount of time it to took to export the query result set, the file name and path of the exported data, and the number of rows written. If the export is unsuccessful, a message appears indicating that the export was unsuccessful.
Using this form of the UNLOAD TABLE statement, the file path is relative to the database server computer.
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0 |