Exporting query results to a CSV or Microsoft Excel spreadsheet file :
Procedure
1.
Type your query in
the SQL Statements pane of Interactive SQL.
2.
At the end of the query,
choose one of the following options:
Option |
Specify the OUTPUT statement |
Export an entire table |
For example: SELECT * FROM TableName; OUTPUT TO 'filepath'; |
Export query results and
append the results to another file |
Specify the APPEND clause: SELECT * FROM TableName; OUTPUT TO 'filepath' APPEND; |
Export query results and
include messages |
Specify the VERBOSE clause: SELECT * FROM TableName; OUTPUT TO 'filepath' VERBOSE; |
Append both results and
messages |
Specify the APPEND and VERBOSE
clauses: SELECT * FROM TableName; OUTPUT TO 'filepath' APPEND VERBOSE; |
Export query results with the
column names in the first line of the file Note If you are exporting
to a Microsoft Excel file, then the statement assumes the first row contains
the column names. |
Specify the WITH COLUMN NAMES
clause: SELECT * FROM TableName;
OUTPUT TO 'filepath' FORMAT TEXT QUOTE '"' WITH COLUMN NAMES; |
Export query results to a Microsoft
Excel spreadsheet |
Specify the FORMAT EXCEL
clause: SELECT * FROM TableName; OUTPUT TO 'filepath'
FORMAT EXCEL |
3.
Click SQL Execute.
Example
The following statement exports the contents of the Customers table from the sample database to a Microsoft Excel workbook called customers.xlsb:
SELECT * FROM Customers; OUTPUT TO 'Customers.xlsb' FORMAT EXCEL