IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to find out the total number of rows in a DB2 table?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sabyasachi

New User


Joined: 31 Aug 2006
Posts: 3

PostPosted: Tue Mar 27, 2007 5:27 am
Reply with quote

Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Mar 27, 2007 5:45 am
Reply with quote

Hello,

You can use SELECT COUNT(*) in your DB2 query.
Back to top
View user's profile Send private message
harshadeshpande

New User


Joined: 23 Mar 2007
Posts: 5
Location: United States

PostPosted: Tue Mar 27, 2007 10:35 am
Reply with quote

If you have FILEAID tool then give your table name and in the NUMBER OF ROWS QUALIFIED give *
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1056
Location: Richmond, Virginia

PostPosted: Tue Mar 27, 2007 5:40 pm
Reply with quote

If your table is huge, SELECT COUNT(*) may not be preferable.

The SYSIBM.SYSTABLES table has this column:

CARDF
Total number of rows in the table or total number of LOBs in an auxiliary table. The value is -1 if statistics have not been gathered or the row describes a view, alias, or created temporary table. This is an updatable column
Back to top
View user's profile Send private message
vini_srcna

Active User


Joined: 26 May 2005
Posts: 178
Location: Copenhagen, Denmark

PostPosted: Tue Mar 27, 2007 8:05 pm
Reply with quote

Quote:
The SYSIBM.SYSTABLES table has this column:


In that case, you may have to check the STATS time. when is the last time statistics was taken. If there is some real time activity against this tables, then this count may not be accurate.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts Identify Number of Multivolume Dataset All Other Mainframe Topics 5
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Create a specific record/file based o... SYNCSORT 8
No new posts Extract ISPF table column headings CLIST & REXX 2
Search our Forums:


Back to Top