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: 19244
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: 1042
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts To find whether record count are true... DFSORT/ICETOOL 6
Search our Forums:

Back to Top