Re: Scheduled execution of SQL statements.
Posted in 2000
"NEWS" <gary.berger@odnss.com> writes:
> Is there a way that I can put SQL statements in a file and run them from
> cron?
Several...
> I am on Informix 5 on SCO. The manuals refer to being able to supply
> a file of inputs instead of going interactive. The programs the references
> site are
> dbaccess and informix-sql.
Either
a) Create a shell-script:
--- CUT HERE ---
#!/bin/sh
# Filename: foo.sh
dbaccess links << EOF!
SELECT foo FROM bar WHERE baz....
EOF!
--- CUT HERE ---
and use cron to execute the script:
25 00 * * * ~informix/bin/foo.sh
or
b) Put the SQL in a file (foo.sql):
SELECT foo FROM bar WHERE baz....
and use cron to execute the script:
25 00 * * * /opt/informix/bin/dbaccess ~informix/sql/foo.sql
Shell-scripts are more flexible;)
Thomas