Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Location
    Egypt
    Posts
    61

    Unanswered: 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

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Try VARCHAR(myColumn,40) (or whatever other value you want instead of 40). This will truncate the data.

    Andy

  3. #3
    Join Date
    Sep 2004
    Posts
    4
    Try cast(c1 as char(15))
    I am sure this will work

    Dakshinamurthi

  4. #4
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •