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 determine the existence of a table in a DB

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-15-11, 19:06
cy163 cy163 is offline
Registered User
 
Join Date: Apr 2007
Posts: 127
How to determine the existence of a table in a DB

Hello ALL,

I wonder how to determine whether a table has already existed in a database.

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-15-11, 20:12
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,198
You can determine whether it exists now by querying syscat.tables. I don't think you can determine whether it existed in the past, but has been dropped.
__________________
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 04-15-11, 23:19
db2girl db2girl is offline
∞∞∞∞∞∞
 
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
You can find info about dropped tables in the history file if it hasn't been pruned.
Reply With Quote
  #4 (permalink)  
Old 04-19-11, 05:16
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
You can also try to create the table and check for an error code returned by DB2.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
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