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
 
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 Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

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