IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

query to fire in order to get the schema of a table.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Thu Apr 20, 2006 4:04 pm
Reply with quote

Hi all,

Can U tell me what query shud I fire in order to get the schema of Table???

I have the table name and need to know the datatypes and fields of that and keys if any exixt?

thanks
kiran
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Apr 20, 2006 4:14 pm
Reply with quote

Hi kiran,

Try with SYSIBM.SYSTABLES or SYSIBM.SYSCOLUMNS. Hope u can get the field description there.
Back to top
View user's profile Send private message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Thu Apr 20, 2006 4:17 pm
Reply with quote

hi kamarutheen,

can u pls write down the query.

thanks
kiran.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Apr 21, 2006 7:29 pm
Reply with quote

Hi Kiran,


Use this query:

Quote:
Note: Use this query in QMF environment only.


Code:
 SELECT * FROM SYSIBM.SYSTABLES;
 SELECT * FROM SYSIBM.SYSCOLUMNS;
Back to top
View user's profile Send private message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Fri Apr 21, 2006 7:45 pm
Reply with quote

hi khamarutheen,

I wanted to know what query shud I write in order to get the schema of a given table with table name EMPTABLE.

I need to know the datatypes and fields of that and keys if any exist for this one.

can you please write down the query.

thanks,
Kiran
Back to top
View user's profile Send private message
BAJJI

New User


Joined: 15 Jul 2005
Posts: 47

PostPosted: Tue Apr 25, 2006 7:37 pm
Reply with quote

Hi,

I found out and here comes the answer...

SELECT * FROM SYSIBM.SYSCOLUMNS WHERE TBNAME LIKE 'EMPTABLE'

In this, all the column names are displayed Row-wise

Regarding keys, we can get the info from the column named NULLS

thanks,
Kiran.
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts count contained values of several col... DB2 5
No new posts DB2 Query to get the count of Unique ... DB2 2
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Create a specific record/file based o... SYNCSORT 8
No new posts Extract ISPF table column headings CLIST & REXX 2
Search our Forums:


Back to Top