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!

Hi All, Can you pls tell me how to 3

Status
Not open for further replies.

gbag

IS-IT--Management
Oct 19, 2003
47
0
0
US
Hi All,
Can you pls tell me how to find row length [row size] for a DB2 table.
Thanks
G
 
Does the programming language help you with LENGTH OF or can you read it in the listing?
 
sum(length) is correct only if the columns in the table don;t include a char or varchar.

So, if you have a char or varchar columns,

select sum(length) from syscat.columns where tabname="tablename" and tabschema="tableschema" and typename not in ('CHARACTER','VARCHAR')

this is your first sum.

then take each column that is a char or varchar and do

select avg(length(rtrim(column))) from tablename

these will be your second sum.

Add these two to get rowsize.

Hope this helps.
 
HI,

Another option is to use a tool like BMC Catalog Manager and do a DESCRIBE or (select S) against that table. There is a field to show the total length of the table.

-PK.Ganapathy
DB2 DBA
TCS

I.T.Analyst
Tata Consultancy Services
 
Hi

If you have Platinum tool, then go to Rc/query and give the table name you get the length.

Hari
TCS
 
Hello all,

The SYSIBM.SYSCOLUMNS contains the coloums mentioned below:

NAME: Name of the coloum
TBNAME: Name of the Table
TBCREATOR:
COLNO:
COLTYPE:
LENGTH: You need to chk it

So if you give a simple select * on the SYSIBM.SYSCOLUMNS
with the TBNAME you will get the col name and the length of it irrespective of the col type.

Hope it helps.

regards.
Samik.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top