Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress column headings & rows counts in CLP 1

Status
Not open for further replies.

shari

MIS
Feb 14, 2001
3
0
0
US
Can anyone tell me how to suppress column headings and/or row counts from a SQL result set that I create via a query run from Command Line Processor.

I'm building RUNSTATS SQL via the following SQL and would like to not have column headings and row counts in the result. It's easy to turn these off in Sybase and Oracle, but I dont' see a way in DB2.

select 'RUNSTATS ON TABLE', tabschema||'.'||tabname, 'AND INDEXES All;'
from sysstat.tables
where tabschema != 'SYSIBM'

If anyone has a better way of building the RUNSTATS SQL I'd like to hear about that too!



 
In the unix enviroment I do something similar. I execute a query with a literal in it, use cut and grep, and pipe the file to a new filename. This new file has only the names of the tables in it. This all enclosed in a shell script that takes in variables such as instance-name ,dbname, and schema owner. It executes the query loops through and runs runstats on the tables, deletes any temp files and terminates.
 
Hi,
The SQL you are using is fine. With that statement in a file (r.sql) you can do :

db2 -tvf r.sql | grep "^RUNSTATS" > runstats.sql

This will just get the RUNSTATS statement.

In DB2 V7 there is a -x flag that gets rid of the header and footer information.

Nana
 
Hi,

You can suppress the column heading and rowcount by executing the query using the following command from CLP

DB2 -x "SELECT * FROM ANYTABLE"

By,
Thangam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top