RE: OUTPUT ... and File Layout
Posted in 2003
If you want to do it in a shell script:
#!/bin/ksh
echo 'output to pipe "cat" without headings
select unique trim(tabname), trim(colname)
from systables a, syscolumns b, sysindexes c
where a.tabid = b.tabid
and b.tabid = c.tabid
and b.colno = c.part1
and a.tabid > 99
and tabtype = "T"' | dbaccess $1 | nawk '/^$/ { continue; }{
printf("update statistics high for table %s \\(%s\\) ditributions
only;\\n",$1,$2);
}'
put this in a file, make is executable and run as
> SCRIPTNAME DATABASE
Regards,
Bill Dare
> -----Original Message-----
> From: Dirk Moolman [SMTP:DirkM@mxgroup.co.za]
> Sent: Thursday, May 22, 2003 8:27 AM
> To: informix-list@iiug.org
> Subject: OUTPUT ... and File Layout
>
> I am generating a script using an unload - actually an output statement:
>
> output to med_h.sql without headings
> select unique "update statistics high for table> "||trim(tabname)||"("||trim(coln
> ame)||") distributions only;"
> from systables a, syscolumns b, sysindexes c
> where a.tabid = b.tabid
> and b.tabid = c.tabid
> and b.colno = c.part1
> and a.tabid > 99
> and tabtype = "T"
>
>
>
> The problem is that, the lines are too long and get cut in half, for
> example
>
> update statistics high for table zzz_cont_contrib(serial_no) dist
> ributions only;> (2 separate lines)
>
>
>
> and this gives me syntax errors. Is there an easy way to generate these
> lines so that they are actually one line inside the output file ?
>
>
>
>
>
>
>
>
> Dirk Moolman
> Database and Unix Administrator
> MXGROUP
>
>
> I feel like I'm diagonally parked in a parallel universe
>