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
 
query to fire in order to get the schema of a table.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: query to fire in order to get the schema of a table.
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: 680
Location: NJ

PostPosted: Thu Apr 20, 2006 4:14 pm    Post subject: DB2 Query
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    Post subject: Re: query to fire in order to get the schema of a table.
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: 680
Location: NJ

PostPosted: Fri Apr 21, 2006 7:29 pm    Post subject: DB2 Query
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    Post subject: Re: query to fire in order to get the schema of a table.
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    Post subject: Re: query to fire in order to get the schema of a table.
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    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 How to force a select query to abend neo4u DB2 2 Mon Apr 23, 2018 1:36 pm
No new posts Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts How to replace the below query? pkmurali DB2 12 Tue Feb 27, 2018 9:51 pm

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