I used this statement
SELECT * FROM SalesOrders;
OUTPUT TO 'e:\\output\\rule_criteria.csv' WITH COLUMN NAMES;
I get an error saying 'WITH' was not expected here. Any way to resolve this? I'm using SQL Anywhere 10.
WITH COLUMN NAMES was an extension that was added to SQL Anywhere beginning in version 12.0.0, so SQL Anywhere 10.x won't be able to accomplish this task.
You could however output the column names to the file first, and then append the results of the select statement:
I.e.
SELECT LIST("name" ORDER BY column_number ASC)
FROM sa_describe_query('SELECT * FROM SalesOrders');
OUTPUT TO 'file.csv';
SELECT * FROM SalesOrders;
OUTPUT TO 'file.csv' APPEND;
The full documentation for OUTPUT TO in version 10 is here: