In Interactive SQL, you can export data from your database to a CSV file by using the OUTPUT statement.
Prérequis
You must have the SELECT ANY TABLE system privilege or SELECT privilege on the table.
In Interactive SQL, connect to a SQL Anywhere database.
Execute an OUTPUT statement with the clauses FORMAT TEXT, QUOTE '"', and WITH COLUMN NAMES to create a comma-delimited format with the column names in the first line of the file. String values are enclosed with quotation marks. For example:
SELECT * FROM SalesOrders; OUTPUT TO 'C:\\LocalTemp\\newSales.csv' FORMAT TEXT QUOTE '"' WITH COLUMN NAMES; |
Exemple
The following example exports the data from the Employees table in the SQL Anywhere sample database to Employees.csv in the C:\LocalTemp directory.
SELECT * FROM Employees; OUTPUT TO C:\LocalTemp\Employees.csv FORMAT TEXT; |
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |