Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Jack Murphy needed a script to export tables to delimited text files at regular intervals, asking how UNLOAD could take a file name and whether a stored procedure could take filename, directory and row count. Bruce Robertson suggested running SQL through dbaccess from the command line; Rob Prop proposed a script. Jack then said it was NT with no Unix shell available. Unresolved.
Auto-generated by Claude from the posts below — may be imperfect; read the full thread.
Jack Murphy — — source: Informix-list mailing list archive (1991-1998)
Hi All,
I would really appreciate your help on this problem that I have.
I need to create a script that will export tables to delimited text files on
a disk at regular intervals.
My problems are these:
1). I assume that UNLOAD will do this for me but how can I pass it a file
name to use to export the data to?
2). Can I write a stored procedure that I can run from the command line that
can take as parameters things like a filename, directory to store it in, and
number of records to export?
I have never really done anything like this before and any help woulr be
much appreciated,
Thanks.
↪ replying to Jack Murphy
Bruce Robertson — — source: Informix-list mailing list archive (1991-1998)
While I can't remember exactly how to do it this might help.
dbaccess can run SQL form the command line. You could use that.
Hope that helps.
Jack Murphy <jmurphy@fore.com> wrote in message
news:7lvgik$hj5$1@shell.fore.com...
> Hi All,
>
> I would really appreciate your help on this problem that I have.
>
> I need to create a script that will export tables to delimited text files
on
> a disk at regular intervals.
>
> My problems are these:
> 1). I assume that UNLOAD will do this for me but how can I pass it a file
> name to use to export the data to?
>
> 2). Can I write a stored procedure that I can run from the command line
that
> can take as parameters things like a filename, directory to store it in,
and
> number of records to export?
>
> I have never really done anything like this before and any help woulr be
> much appreciated,
>
> Thanks.
>
>
>
↪ replying to Jack Murphy
Rob Prop — — source: Informix-list mailing list archive (1991-1998)
Hi Jack,
If I understood your question, you want to make a script/program or
something like that that exports data from a table to a ASCII file. What
you could do is the following:
Make a script which looks like this:
------------------------------------------------------------------
#!/bin/ksh
DBNAME=${1}
TABNAME=${2}
ASCII_FILE=${3}
dbaccess ${DBNAME} 1>/dev/null 2>&1 <<EOF
UNLOAD TO "${ASCII_FILE}" DELIMITER "#"
SELECT * FROM ${TABNAME}
EOF
-----------------------------------------------------------------------
This script should do the job.
Greetings,
Rob Prop
↪ replying to Rob Prop
Jack Murphy — — source: Informix-list mailing list archive (1991-1998)
Hi All,
Sorry,I should have stated platform. We are trying to do this on NT and the
problem is that we cannot install a Unix shell...
Thanks,
J.
Rob Prop <rprop@concepts.nl> wrote in message
news:3783A060.5BD32B58@concepts.nl...
> Hi Jack,
>
> If I understood your question, you want to make a script/program or
> something like that that exports data from a table to a ASCII file. What
> you could do is the following:
>
> Make a script which looks like this:
>
> ------------------------------------------------------------------
>
> #!/bin/ksh
>
> DBNAME=${1}
> TABNAME=${2}
> ASCII_FILE=${3}
>
> dbaccess ${DBNAME} 1>/dev/null 2>&1 <<EOF
>
> UNLOAD TO "${ASCII_FILE}" DELIMITER "#"
> SELECT * FROM ${TABNAME}>
> EOF
>
> -----------------------------------------------------------------------
>
> This script should do the job.
>
> Greetings,
>
> Rob Prop
>
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.