Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2013
    Posts
    3

    Unanswered: Combine two columns of same data type into single column

    Hi,
    I have a table with the following data:

    TABLE TAB1

    ID FIRST_NAME LAST_NAME GROUP
    -------- ---------- ---------- ----------
    1 SMITH D B2
    2 ALLEN G A4
    3 BAKER J H9

    I want to see the result data as follows:

    FULL_NAME
    --------------
    SMITH D

    I tried to get result using "select (FIRST_NAME+LAST_NAME) as FULL_NAME from tab" and also "select FIRST_NAME+LAST_NAME as FULL_NAME from tab"

    The error i got is
    SQL0420N Invalid character found in a character string argument of the
    function "DECFLOAT". SQLSTATE=22018

    Please help me to achieve this.

  2. #2
    Join Date
    Apr 2006
    Location
    Belgium
    Posts
    2,514
    Provided Answers: 11
    concat function or || : concat is save as || is sometimes interpreted on unix as a different character
    CONCAT - IBM DB2 9.7 for Linux, UNIX, and Windows
    rtrim can also be used to remove trailing blanco's
    Best Regards, Guy Przytula
    Database Software Consultant
    Good DBAs are not formed in a week or a month. They are created little by little, day by day. Protracted and patient effort is needed to develop good DBAs.
    Spoon feeding : To treat (another) in a way that discourages independent thought or action, as by overindulgence.
    DB2 UDB LUW Certified V7-V8-V9-V9.7-V10.1-V10.5 DB Admin - Advanced DBA -Dprop..
    Information Server Datastage Certified
    http://www.infocura.be

Posting Permissions

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