cancel
Showing results for 
Search instead for 
Did you mean: 

SQL Anywhere 12, Interactive SQL, How to "output" to relative path

Former Member
0 Kudos

Hi everyone,

is there a way to store the file from an output-statement relatively to the path of the script-file when running SQL-Scripts from Interactive SQL on windows?

If I try this


Select 'Test';

Output To 'test.txt' Format Text;

in a script I only get an "Access denied"-message, so I think Interactive SQL is trying to store the file in a directory where the current windows-user does not have write-permissions. If I use the absolute path to the directory from where the script is opened, everything works fine. So how does Interactive SQL decide where to put the file, if no absolute path is given?

Thanks in advance,

Torben

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I'm not aware of any option to output to the directory of the current script, but it should by default output to the current working directory of Interactive SQL:


[E:\]mkdir out_test

[E:\]cd out_test

[E:\out_test]dbisql -c "DSN=SQL Anywhere 16 Demo" "select 'test'; output to 'test.out'"

Execution time: 0.014 seconds

Exporting data to "E:\out_test\test.out"

1 rows written to "E:\out_test\test.out"

Execution time: 0.023 seconds

If you start Interactive SQL from the start menu, however, the current working directory may be one of the system folders for the user. Output to such a directory may not work without "Run as Administrator".

Hope this helps,

Tyson

Former Member
0 Kudos

Hi Tyson,

thanks for your reply. That's what I thought (and feared).

So there is no way to set the working directory when starting Interactive SQL via GUI? In most cases we start it by connecting a database in Sybase Central and launching Interactive SQL from there.

And another reason why I'm wondering: With "input" this seems to work as expected. If I start a script with an "input"-statement, the file is first searched for in the directory from where the script is opened. So I wonder why this is not working with "output".

Regards,

Torben

Answers (0)