You can export a table by executing an UNLOAD TABLE statement from Interactive SQL.
Prerequisites
The permissions required to execute an UNLOAD statement depend on the database server -gl option, and also on whether or not the data is being written to a file on a client computer.
Context and remarks
The following procedures can also be used to export views.
You can also export a table by selecting all the data in a table and exporting the query results.
Execute an UNLOAD TABLE statement. For example:
UNLOAD TABLE Departments TO 'departments.csv'; |
This statement unloads the Departments table from the SQL Anywhere sample database into the file departments.csv in the database server's current working directory. If you are running against a network database server, the statement unloads the data into a file on the server computer, not the client computer. Also, the file name passes to the server as a string. Using escape backslash characters in the file name prevents misinterpretation if a directory or file name begins with an n (\n is a newline character) or any other special characters.
Each row of the table is output on a single line of the output file, and no column names are exported. The columns are delimited by a comma. The delimiter character can be changed using the DELIMITED BY clause. The fields are not fixed-width fields. Only the characters in each entry are exported, not the full width of the column.
Discuss this page in DocCommentXchange.
|
Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1 |