on 2012 Nov 16 11:18 AM
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To answer some questions:
The EXACT code i was running =
select FLD_VAL1 from param where FLD_NAME='COUNTRY_OFF_INSTALL';
OUTPUT TO 'country_of_install.txt' FORMAT ASCII APPEND;
I also tried: ... OUTPUT TO 'myTextfile.txt' APPEND FORMAT TEXT but it returned same error
I noticed that for the test I did:
- against Sybase 6.0.3: I used dbisql.exe
- against Sybase 11.0.1: I used dbisqlc.exe
Reason: these sql editors are part of a software package we distribute. The older version of our software package is containing dbisql.exe while the newer one is having dbisqlc.exe installed (for maintenance purposes on the application db).
So, as i can derive from the link Volker posted (thx again!):
It seems for Sybase v11.0.1, dbisqlc.exe does not support the "OUTPUT APPEND".
And I guess dbisql.exe (notice: without the c) in Sybase v6.0.3. probably does not either.
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
The docs of 11.0.1 say this about append:
The APPEND keyword is valid if the output format is TEXT, FIXED, or SQL
ASCII doesn't seem to be an "official" output format for the output statement at least in 11:
output-format : TEXT | FIXED | HTML| SQL | XML
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Have you tried
OUTPUT TO 'myTextfile.txt' APPEND FORMAT TEXT
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
67 | |
10 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.