If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Is there any way to get the row count from System.catalog

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-13-09, 17:33
swati malla swati malla is offline
Registered User
 
Join Date: Jul 2009
Posts: 26
Is there any way to get the row count from System.catalog

Hello Everyone,
I am very new to DB2 and stared learning of it.
I am using this following query to get the schema and table names from a data base

String query="SELECT TABSCHEMA, TABNAME, TYPE, COLCOUNT, KEYCOLUMNS, KEYINDEXID, KEYUNIQUE FROM SYSCAT.TABLES WHERE TABSCHEMA NOT LIKE 'SYS%' AND TYPE = 'T' ";


So my question is
1)Is there any way to get the row count by using SYSCAT.TABLES.

i tried this one
SELECT ROWSIZE,TABSCHEMA, TABNAME, TYPE, COLCOUNT, KEYCOLUMNS, KEYINDEXID, KEYUNIQUE FROM SYSCAT.TABLES WHERE TABSCHEMA NOT LIKE 'SYS%' AND TYPE = 'T' ";


But it did not execute it gave me this exception as follows.
DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=ROWSIZE,


Any help is really appreciated.

Thanks in advance

Regards,
swati
Reply With Quote
  #2 (permalink)  
Old 07-13-09, 18:38
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Please refer to the SQL Reference Vol 1, Appendix D. System catalog views for a description of the SYSCAT.TABLES view. You will find a column in there that contains the number of rows in the table, but keep in mind that it is only updated after runstats utility is run on the table.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #3 (permalink)  
Old 07-13-09, 20:54
swati malla swati malla is offline
Registered User
 
Join Date: Jul 2009
Posts: 26
Thanks a lot it got worked.....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On