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
 

 

how to get the coloumns of a table in a horizontal way

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
kalinga

New User


Joined: 25 May 2005
Posts: 4
Location: chennai,india

PostPosted: Tue May 31, 2005 12:54 pm    Post subject: how to get the coloumns of a table in a horizontal way
Reply with quote

hi,

say i'm having a table called EMP_TABLE, in that the columns are emp_id,sal,name,loc.

EMP_DEP HAS SOME COLUMNS

i am executing the query USING CURSOR SELECT * FROM EMP_TABLE, EMP_DEP. I WANT TO GET THE ANSWER LIKE BELOW


EMP_TABLE 100 9999 xyz mum
EMP_DEP 92K RUBBER SOFA
EMP_TABLE 200 8888 zyx chn
EMP_DEP 34S STEEL BUS
AND SO ...............ON
Back to top
View user's profile Send private message

vasanthanc

New User


Joined: 01 Apr 2005
Posts: 58

PostPosted: Tue May 31, 2005 1:59 pm    Post subject:
Reply with quote

But why do you want the table name in your result, that to when u r using cursor ?
Lets come to your question. How do you compare which emp belongs to which department? There should be a common field. (i.e) there should be a field in emp_table like emp_dept_no and similar field should be there in emp_dep table also. then u can write the query as

Select * from Emp_Table, Emp_Dept
where EMP_TABLE.EMP_DEPT_NO = EMP_DEP.DEPT_NO

I think, this is what you needed (?)
Back to top
View user's profile Send private message
MGIndaco

Active User


Joined: 10 Mar 2005
Posts: 432
Location: Milan, Italy

PostPosted: Tue May 31, 2005 3:18 pm    Post subject:
Reply with quote

If you are running a Cobol program you can have your columns in the way you need. If you use a DCL and you fetch with your coursor you can establish the direction of data and name of columns.

But if you need display the same information as the sample above in QMF you must use a most complex query that needs information NAME from the SYSIBM.SYSCOLUMNS.
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 SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Need Rexx Program to Load in to DB2 T... Hareesh Verma CLIST & REXX 22 Tue Sep 20, 2016 2:59 pm
No new posts Command UNIQUE CONSTRAINT on any tabl... rohanthengal DB2 2 Thu Aug 18, 2016 3:48 pm
No new posts Updating online Db2 table kishpra DB2 3 Fri Aug 12, 2016 2:44 pm
No new posts Getting soc4 on internal table in cobol abdulrafi COBOL Programming 13 Fri May 06, 2016 3:39 pm


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