on 2017 Jun 21 8:04 AM
Hi
I am using the OUTPUT TO
function in ISQL and it all works fine.
When I add in the 'WITH COLUMN NAMES
' the query doesn't work. I am using ASA 9, is it not possible to export column names in ASA 9?
SELECT * FROM dba.table1 ORDER BY table1.part_number ASC; OUTPUT TO 'c:\\\\filename.csv' FORMAT ASCII QUOTE '"' WITH COLUMN NAMES
If not is there a workaround for exporting the column names?
The WITH COLUMN NAMES clause was added to the OUTPUT command with v12, so it's clearly not available with v9.
A workaround is to use two queries:
select list(string('"', cname, '"') order by colno asc) from sys.syscolumns where creator = 'dba' and tname = 'table1'; output to 'c:\\\\filename.csv' format ascii quote '"';
select * from dba.table1 order by table1.part_number asc; output to 'c:\\\\filename.csv' format ascii quote '"' append;
(Have not tested the queries lacking v9, but you should get the point...)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.