When you want to export the result of a query to a file using the OUTPUT statement, you apparently have the option to APPEND the result to an existing file. However when I try to run this command like in the example below it fails saying "Syntax error at line2": SELECT myFIELD FROM myTABLE where myOtherField='XYZ'; OUTPUT TO 'myTextfile.txt' FORMAT ASCII APPEND Without the APPEND it works fine so it does not seem to recognize the APPEND option. I tried with ASA 6 and 11 ... same result. Is this an known issue? |
I cannot reproduce your problem. I tested with the latest 11.0.1 build, connected to the demo database that comes with SQL Anywhere, opened DBISQL, and executed the following statements twice: select * from departments; output to 'c:\test.txt' FORMAT ASCII APPEND The "test.txt" file contains 10 lines, as expected. There was no syntax error. "TEXT" was added as a synonym for "ASCII" in 11.0.1 starting in build 1150. They both mean the same thing. Are there any other details you can provide to help us reproduce the problem? |
Have you tried OUTPUT TO 'myTextfile.txt' APPEND FORMAT TEXT |
The docs of 11.0.1 say this about append:
ASCII doesn't seem to be an "official" output format for the output statement at least in 11:
Presumably ASCII should be a synonym for TEXT. Btw. i don't get an error with FORMAT ASCII APPEND in 11.0.1.2606. Perhaps this error was already corrected in a newer build? |
Are you using dbisqlc (in contrast to DBISQL aka Interactive SQL)? I'm using dbisqlc quite often and typically stumble over the fact that dbisqlc does not support all of the documented OUTPUT command's options, and APPEND is not supported AFAIK. So, with SA 12.0.1.3769, the following query: select * from departments; output to 'c:\test.txt' FORMAT TEXT APPEND does work as expected with DBISQL but reports a syntax error with dbisqlc. For further reading, confine this FAQ and John's (i.e. the expert's) answer: To answer some questions: The EXACT code i was running = I also tried: ... OUTPUT TO 'myTextfile.txt' APPEND FORMAT TEXT but it returned same error I noticed that for the test I did: So, as i can derive from the link Volker posted (thx again!): I need the functionality for v6.0.3. and was just curious how v11.0.1 was behaving. So seems I need to look for another solution. Big thanks for your help! Krgds Berto
(19 Nov '12, 09:01)
Berto
Replies hidden
Can't tell on the 6.0.3 DBISQL tool (FWIW, with v7, I'm quite sure APPEND is supported). But without that, outputting to different files and concatenating them with COPY + may be an easy solution.
(19 Nov '12, 10:32)
Volker Barth
|
Please show us the EXACT code that gives the error, not a "command like" the one that gave the error.