Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.


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?

FROM dba.table1
ORDER BY table1.part_number ASC;
OUTPUT TO 'c:\\filename.csv'
    QUOTE '"'

If not is there a workaround for exporting the column names?

asked 21 Jun '17, 07:04

Jongee's gravatar image

accept rate: 0%

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:

  • A first query to export the column names, such as
    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 '"';
  • Your original query as second one - and OUTPUT used with the APPEND option
    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...)

permanent link

answered 21 Jun '17, 07:38

Volker%20Barth's gravatar image

Volker Barth
accept rate: 34%

edited 21 Jun '17, 07:42

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 21 Jun '17, 07:04

question was seen: 3,835 times

last updated: 21 Jun '17, 07:42