Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi, am trying to write unix script to pull large data from my informix database and schedule time for it(every morning) and save it as an excel file in a folder name daily_report.
this my SQL statement
unload to suspend101_20090110
select usertype, count(msisdn)
from basetab
where AccountState!=3 and CallServiceStop<'20090110'
and PreAccountStop<'20090110' and AccountStop>='20090110'
group by usertype
order by 1;br
temmy

On the Unix side, this korn shell script, will execute your SQL: Unforutunately, I don't know a way of informix creating an Excel spreadsheet. I think you're left with moving the text file to Window's and pulling the file into Excel.
#!/bin/ksh
# set to your database nameDBNAME="mydatabasename";
export DBNAME
# use dbaccess or isqlINTERFACE_CMD="dbaccess";
export INTERFACE_CMD# send to standard output
DBCOMMAND="$INTERFACE_CMD -e $DBNAME";
export DBCOMMANDengine_up=$(onstat - | grep "Up" | wc -l)
if [ $engine_up -eq 0 ]
then
echo "Informix Engine must be Up to execute commands."
exit
fi# untested
$DBCOMMAND << MSG
unload to suspend101_20090110
select usertype, count(msisdn)
from basetab
where AccountState!=3 and CallServiceStop<'20090110'
and PreAccountStop<'20090110' and AccountStop>='20090110'
group by usertype
order by 1;
MSG

![]() |
![]() |
![]() |
| Login or Register to Reply | |
| Login | Register |
| Ads by Google |