Re: Export to ASCII file
Posted in 2001
--- Andrew Pearson <apearson@pt.lu>
> wrote:
>Stuart wrote:
>>
>> I am trying to export a table to an ASCII file in a stored procedure on a
>> UNIX box.
>>
>> I was using :
>>
>> Unload to 'file'
>> select * from my_table
>> where field = "123";>>
>> Which causes a syntax error.
>>
>> Is 'unload' a command that i can use in stored procedures, or is it only
>> useable in the 'dbacess' program?
>
>Yes, you are right. UNLOAD is a feature of dbaccess and you can't
>use it in SPL or 4GL programs.
Yes, but you can accomplish virtually the same thing in 4gl by directing your output to a file rather than a printer (with the added benefit of being able to control the formatting of the output).
>If your SP is not used very often
>then you can work around by running a script on the UNIX box from
>the SP, which would do something like
>
>dbaccess $DBNAME << sseccabd
>UNLOAD TO $FILE SELECT * FROM my_table WHERE field = $VAR>sseccabd
>
>But make sure that your script sets absolutely all the variables
>it needs, including the path, INFORMIXDIR, INFORMIXSERVER and the
>whole shebang.
>
>It's not a great solution for an SP that gets used a lot because
>of the overhead of invoking the script and dbaccess.
>
>--
>So Archimedes Plutonium is tied to a stake in the backyard, and
>sleeping in his kennel. K*bo tiptoes up (carrying a dustbin lid)
>and measures the length of the chain Arch is tied to, then marks
>a radius on the ground...
==
"Outlook not so good."
That magic 8-ball knows everything!
I'll ask about Exchange Server next.
_____________________________________________________________
Want a new web-based email account ? ---> http://www.firstlinux.net