MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get list of column names in a table

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Thu Mar 25, 2010 12:40 pm    Post subject: Get list of column names in a table Reply with quote

This will get me a list of table names in a database :

Code:
SELECT * FROM SYSIBM.SYSTABLES                   
   WHERE DBNAME = 'H2591PAU'   


Is there a similar statement that will get me a list (vertical,
not horizontal) of column names in a particular table ?


Thanks...
Back to top
View user's profile Send private message
NASCAR9
Intermediate


Joined: 08 Oct 2004
Posts: 274
Topics: 52
Location: California

PostPosted: Thu Mar 25, 2010 1:02 pm    Post subject: Reply with quote

Yes,

Below is what I've used in the past.
Code:

SELECT A.NAME, A.TBNAME,  B.tsname, A.COLNO, A.COLTYPE,               
       A.LENGTH, A.SCALE, A.NULLS, B.REMARKS, A.REMARKS     
   FROM SYSIBM.SYSCOLUMNS A                                 
   LEFT JOIN SYSIBM.SYSTABLES B     ON A.TBNAME    = B.NAME
WHERE A.NAME = 'RELATION_ID'
 
A different 'WHERE Condition'

 WHERE A.TBCREATOR   = 'FDBEL'   
  and A.TBNAME = 'RETIREE_SIT_TAX_REFUND'   
 ORDER BY A.TBNAME, A.COLNO;

_________________
Thanks,
NASCAR9
Back to top
View user's profile Send private message
tcurrier
Intermediate


Joined: 10 Feb 2006
Posts: 188
Topics: 68

PostPosted: Thu Mar 25, 2010 3:51 pm    Post subject: Reply with quote

NASCAR9..

Great, got it to work ... thanks !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group