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

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


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top