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
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.