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
 
Concatenating all columns

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

New User


Joined: 13 Jun 2005
Posts: 12
Location: chennai

PostPosted: Thu Dec 11, 2008 7:28 pm    Post subject: Concatenating all columns
Reply with quote

We would like to create a view on a table by concatenating the columns in the table as single column in the view.
Example:
Table T1 has the below structure:
Col1 CHAR (3) Col2 CHAR (4) Col3 CHAR (5) Col4 CHAR (3) Col5 CHAR (2)

We would like to create a view v1 on Table T1 whose structure is as follows:
Colx

where colx is defined as col1 ]] col2 ]] col3 ]] col4 ]] col5
in the Create View DDL statement.

So the columns in T1 are concatenated to form one column Colx in the view.

This view creation will work only if all columns in the Table T1 are defined as character datatype as given in the above example.

Is there a way to create a view by concatenating all columns from a Table, where the table structure looks as below:
Col1 CHAR (3) Col2 CHAR (4) Col3 CHAR (5) Col4 DECIMAL Col5 CHAR (2)
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu Dec 11, 2008 7:35 pm    Post subject:
Reply with quote

you can CAST non char datatypes to char and then concatenate them.
Back to top
View user's profile Send private message
muralithirumalaisamy
Warnings : 1

New User


Joined: 13 Jun 2005
Posts: 12
Location: chennai

PostPosted: Tue Dec 16, 2008 4:50 pm    Post subject: Concatenating all columns
Reply with quote

Can you just help me in writing that query which will do the concatination of columns...
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 unload data from table with lob columns farhad_evan DB2 1 Sat Apr 22, 2017 1:32 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Comparing Decimal and CHAR columns rakesh17684 DB2 7 Thu Oct 20, 2016 2:33 am
No new posts Combine columns without breaking words Indrajit_57 SYNCSORT 1 Sat Mar 19, 2016 9:33 am
No new posts Concatenating 2 VB & 1 FB file an... raja_natural SYNCSORT 3 Sun Sep 27, 2015 2:36 am

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