Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to find out the total number of rows in a DB2 table?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: How to find out the total number of rows in a DB2 table?
Reply with quote

Back to top
View user's profile Send private message

dick scherrer

Site Director


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

PostPosted: Tue Mar 27, 2007 5:45 am    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Tue Mar 27, 2007 5:40 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us