If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > DB2 CLP output column length

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-20-04, 08:56
hanyheggy hanyheggy is offline
Registered User
 
Join Date: Jan 2004
Location: Egypt
Posts: 61
DB2 CLP output column length

hi,

i allways use C program to access DB2 data, sometimes i need to limit the output length of a CHAR/VARCHAR column from Command line, is there any option for that ?

i tried left (c1, 15) and it does not work
also tried rtrim(c1) didnot work either

any ideas ?
__________________
hany heggy,
IBM certified Professional, AIX system support
www.melodyhits.tv
Reply With Quote
  #2 (permalink)  
Old 09-20-04, 09:51
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
Try VARCHAR(myColumn,40) (or whatever other value you want instead of 40). This will truncate the data.

Andy
Reply With Quote
  #3 (permalink)  
Old 09-29-04, 08:28
rdmurthi rdmurthi is offline
Registered User
 
Join Date: Sep 2004
Posts: 4
Try cast(c1 as char(15))
I am sure this will work

Dakshinamurthi
Reply With Quote
  #4 (permalink)  
Old 09-30-04, 15:34
dbamota dbamota is offline
Registered User
 
Join Date: Sep 2003
Posts: 237
problem with varchar(col,11); each time it truncates its giving the following message
Recxxxxx F
SQL0445W Value "Recxxxxx FP " has been truncated.
SQLSTATE=01004

No problem with substr(col,1,11) instead of varchar(col,11) where col is your column name
__________________
mota
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On