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

Concatenating all columns


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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: 6966
Location: porcelain throne

PostPosted: Thu Dec 11, 2008 7:35 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts DB2 Views with Multiple SQL & Col... DB2 8
No new posts SORT - To repeat a string in same col... SYNCSORT 3
No new posts JCL - To repeat a string in same colu... JCL & VSAM 2
Search our Forums:

Back to Top