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 > Distinguish between table and view in db2 ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-31-08, 02:39
vilius vilius is offline
Registered User
 
Join Date: Nov 2007
Posts: 55
Distinguish between table and view in db2 ?

Hi,

I just have name of the object which is table or view.
How to know which one it is ?

thanks
Vilius
Reply With Quote
  #2 (permalink)  
Old 10-31-08, 03:01
madhu_kaza madhu_kaza is offline
Registered User
 
Join Date: Apr 2008
Posts: 39
SYSIBM.SYSTABLES catalog table has a type column where you can check whether the object is of type table or view.

SELECT name, type from sysibm.systables where name='object name'

Gives whether the "name" object is of type table or view or alias.

Type of objects are
A - Alias
T - Table
V - View

For more info you can refer to
http://publib.boulder.ibm.com/infoce...ablestable.htm

Thanks,
Madhavi.
Reply With Quote
  #3 (permalink)  
Old 10-31-08, 03:05
madhu_kaza madhu_kaza is offline
Registered User
 
Join Date: Apr 2008
Posts: 39
SYSIBM.SYSTABLES catalog table has a type column where you can check whether the object is of type table or view.

SELECT name, type from sysibm.systables where name='object name'

Gives whether the "name" object is of type table or view or alias.

Type of objects are
A - Alias
T - Table
V - View

For more info you can refer to
http://publib.boulder.ibm.com/infoce...ablestable.htm

Thanks,
Madhavi.
Reply With Quote
  #4 (permalink)  
Old 10-31-08, 05:16
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
if type of object is N - then it means it is a nickname which is used in case of federated databases.
Reply With Quote
  #5 (permalink)  
Old 10-31-08, 06:18
stolze stolze is offline
Registered User
 
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
Nicknames exist in DB2 LUW and there you query SYSCAT.TABLES. The tables in the SYSIBM schema are not documented (except SYSIBM.SYSDUMMY1) and relying on them in DB2 LUW is like begging for problems.
__________________
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