Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us