cancel
Showing results for 
Search instead for 
Did you mean: 

Export file using Sybase Event

Former Member
3,694

I'm trying to output a file to a shared folder, I can make the output but I can't run it on a event/Stored Procedure.

The code snippet that I have to the output is this:

BEGIN 
    select * from table1; output to 'c:\\\\teste.txt' format text with COLUMN names
END

But when I include this in a event, the sybase gives me this error.

[Sybase][ODBC Driver][SQL Anywhere]Syntax error near 'output' on line 2 SQLCODE: -131 SQLSTATE: 42000 SQL Statement: ALTER EVENT "dba"."Export" HANDLER BEGIN select * from table1; output to 'c:\\teste.txt' format text with format text with COLUMN names END

I am using Sybase Central with sql anywhere 12

Accepted Solutions (0)

Answers (2)

Answers (2)

MarkCulp
Participant

The OUTPUT statement is a client side dbisql[c] statement and is not understood by the database server. Have a look at the UNLOAD statement.

Example:

UNLOAD 
SELECT * from table1
    TO 'c:\\\\teste.txt'
FORMAT text;
Former Member

The OUTPUT statement is implemented by dbisql only.

For an Event Handler to do something similar, it would need to use an UNLOAD. V12 and higher versions can UNLOAD from a query.