RE: Urgent
Posted in 2000
Create a shell script along the lines of
!/bin/ksh
dbaccess joe - <<-EOF
unload to "/tmp/joe1" delimiter "|"
select count(*), sum(tabid) from systables;
unload to "/tmp/joe2"
select * from tab1;EOF
cat /tmp/joe1 /tmp/joe2 /tmp/joe1 > /tmp/joefin
echo "Done"
Unfortunately I din't have the employee table at
hand so you'll have to do some work :)
HTH Jo
> From: a_blonde@mindless.com
> >
> > ---- you wrote:
> > > From: "Sarah Jessica" <sarah_jessica@hotmail.com>
> > > >
> > > >I am unloading the data into the test.dat. How can I
> have the header
> >and
> > > >trailer that having the record count and the total amount.
> > > >
> > > >The Employee table is like this:
> > > >eno smallint
> > > >ename char(20)
> > > >amount money(14,2)
> > > >
> > > >Now when I use the unload command like this
> > > >unload to "/home/sarah/test.dat" delimiter "|"
> > > > select * from employee;> > > >
> > > >This will only unload all the records; but not have any
> header or
> >trailer
> > > >showing that; this is having so many records and total amount.
> > > >Hope the group will comeout with positive response.
> > >
> > > Nope. UNLOAD by itself won't do that. But you can try
> something like:
> > >
> > > unload to "/home/sarah/test.dat" delimiter "|"
> > > select count(*), sum(amount) from employee;
> > > unload to pipe "cat >> /home/sarah/test.dat" delimiter "|"
> > > select * from employee;
> > > unload to pipe "cat >> /home/sarah/test.dat" delimiter "|"
> > > select count(*), sum(amount) from employee;> >
> >That's cool Dude! Is that in version 9?
>
> I said you could try it. I (still) have no idea whether or
> not it will
> work... :-)
>
> That's a lie. I tried it. It doesn't work (in 7.31, anyway). Sorry.
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
___________________________________________________________________________
This email is confidential and intended solely for the use of the
individual to whom it is addressed. Any views or opinions presented are
solely those of the author and do not necessarily represent those of
Sema Group.
If you are not the intended recipient, be advised that you have received this
email in error and that any use, dissemination, forwarding, printing, or
copying of this email is strictly prohibited.
If you have received this email in error please notify the Sema Group
Helpdesk by telephone on +44 (0) 121 627 5600.
___________________________________________________________________________