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 > How to find tables with no rows in a database

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-17-10, 08:39
Neharao Neharao is offline
Registered User
 
Join Date: Dec 2007
Posts: 49
How to find tables with no rows in a database

Hello all

In a database how to know the list tables with 0 rows. ( Count(*) = 0)

Can we achieve this in a single query

Thank You
Kalyani Ch
Reply With Quote
  #2 (permalink)  
Old 03-17-10, 09:02
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,574
Sure, if your runstats are current:

Code:
select tabschema,tabname from syscat.tables where card = 0
Andy
Reply With Quote
  #3 (permalink)  
Old 03-17-10, 10:10
Cougar8000 Cougar8000 is offline
Registered User
 
Join Date: Nov 2005
Location: IL
Posts: 554
Yes, but only if stats were collected. Other wise I would write a shell loop to go after all tables.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows

DB2 v9.1.0.2 os 5.3.0.0
Reply With Quote
  #4 (permalink)  
Old 03-17-10, 10:36
Neharao Neharao is offline
Registered User
 
Join Date: Dec 2007
Posts: 49
Thank You. It 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