on 10-02-2018 1:29 AM
for example
CREATE PROCEDURE "DBA"."usp_TestOutput"()
BEGIN
DECLARE sqlTxt VARCHAR(4096);
SET sqlTxt = 'SELECT * from SYCONFIG; SELECT sys_Key from SYCONFIG'; EXECUTE IMMEDIATE WITH RESULT SET ON sqlTxt;
SET sqlTxt = 'SELECT sys_Key from SYCONFIG';
EXECUTE IMMEDIATE WITH RESULT SET ON sqlTxt;
END
BEGIN
EXECUTE "DBA"."usp_TestOutput";
output to 'C:\Test.out'
END;
Returns and error at output, I have tried other methods as well like using UNLOAD to no luck/
Can someone give me a direction please.
Thanks Terry
UNLOAD SELECT ... should work here, without need to use dynamic SQL. The filename can be specified via variable as well. OUTPUT is an ISQL command and therefore cannot be used within code blocks.
Such as
UNLOAD SELECT sys_Key FROM SYCONFIG TO 'C:\\Test.txt' FORMAT TEXT;
----
FWIW, I recommend to ask your question in the SQL Anywhere Forum (which has a number of questions related to OUTPUT/UNLOAD), because the current changes in the SAP Community (aming others, the dropped SQL Anywhere topic page) bear the risk that your questions may become invisible to the relevant experts.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.