You can also export a table by selecting all the data in a table and exporting the query results. See Export query results.
Use the same procedures to export views.
Run the following command:
dbunload -c "DBN=demo;UID=DBA;PWD=sql" -t Employees c:\DataFiles |
In this command, -c specifies the database connection parameters and -t specifies the name of the table or tables you want to export. This dbunload command unloads the data from the SQL Anywhere sample database (assumed to be running on the default database server with the default database name) into a set of files in the c:\DataFiles directory on the server computer. A command file to rebuild the tables from the data files is created with the default name reload.sql in the local current directory.
You can unload more than one table by separating the table names with a comma (,) delimiter.
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 command 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. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |