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

asked 13 May '15, 11:20

tcmss's gravatar image

tcmss
25111
accept rate: 0%


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;
permanent link

answered 13 May '15, 12:10

Mark%20Culp's gravatar image

Mark Culp
22.9k9129270
accept rate: 40%

edited 13 May '15, 12:13

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.

permanent link

answered 13 May '15, 12:09

Nick%20Elson%20SAP%20SQL%20Anywhere's gravatar image

Nick Elson S...
7.3k35107
accept rate: 31%

Your answer
toggle preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×90
×35
×15

question asked: 13 May '15, 11:20

question was seen: 576 times

last updated: 13 May '15, 12:13