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

Converting VARCHAR to CHAR


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Shanu.sukoor

New User


Joined: 31 Jan 2006
Posts: 32
Location: India

PostPosted: Fri Sep 28, 2007 1:53 pm
Reply with quote

Hi,

I have a query which fetches a field of 255 bytes. But it is VARCHAR. What I need to do is to append spaces in the remaining bytes after the string and the length should be constant. This should be done through query itself!

So the selected string will have 255 bytes. Can I concatinate spaces with the string?

Please help me.

Thank you,

Shanu
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Fri Sep 28, 2007 5:10 pm
Reply with quote

try
CHAR(varchar_col_name,254). This will return a char string of length 254. It can't be 255 as per restriction on CHAR function.

check this link for reference.
publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/admin/r0000777.htm

If you need varchar-col to be of 255..probably you can do a simple concat like this
CONCAT(CHAR(varchar_col_name,254),' ')
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Exclude rows with > than x occurre... DFSORT/ICETOOL 6
No new posts Converting fixed length file to excel... IBM Tools 7
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
Search our Forums:

Back to Top