I need to know if this is possible. I need to create a new event that will execute a query and dump the results into a flat file. This event will be run in the middle of the night without any user intervention.

What commands do I execute to achieve this?

[edit] Rookie mistake; forgot to mention that this was for a version 8 or 9 database.

asked 24 Apr '12, 12:29

Bwery's gravatar image

Bwery
76448
accept rate: 0%

edited 24 Apr '12, 12:35


The UNLOAD SELECT statement is your friend - I'm quite sure there are some examples and discussions on this facility (vs. OUTPUT, which won't work in procedures and events) in this forum.


Just to add w.r.t. older versions: AFAIK, both events and the UNLOAD statement have been available since v7, so you're alright with v8/v9:)

permanent link

answered 24 Apr '12, 12:33

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819
accept rate: 34%

edited 25 Apr '12, 06:50

That works. Thanks a lot.

(24 Apr '12, 12:40) Bwery

To dump query results to a flat file, I fire-up Sybase Central then connect to the DB. I then right-click on the connected database to run ISQL. I paste the query into ISQL and generate the result. Then select Data Export to save the result to a text file. Not sure about sa 8/9 compatibility.

permanent link

answered 25 Apr '12, 08:58

dejstone's gravatar image

dejstone
959405069
accept rate: 0%

1

That does work for interactive users, as does using Interactive SQL with the OUTPUT statement and its various data formats - both with v8/v9, too.

Note, however, that this does not work well (err, not at all) for an automated event that has to run nightly:)

(25 Apr '12, 09:36) Volker Barth
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:

×18

question asked: 24 Apr '12, 12:29

question was seen: 3,451 times

last updated: 25 Apr '12, 09:36