DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: concat ||

Hybrid View

  1. #1
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Hi friends..

    I know that this is probably an easy one for you..

    I need each column I select to be seperated with a comma

    eg.

    select col1 ||','||, col2||','||, col3 ||','
    from table1

    result should look like this

    col1 ',' col2 ',' col3 ','
    ---------------------------
    a, b, c,

    Can anyome please give me the correct syntax

    Thanks

    Suresh
    Once you have eliminated all of the impossible,
    whatever remains however improbable,
    must be true.

  2. #2
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Originally posted by Sureshy
    select col1 ||','||, col2||','||, col3 ||','
    from table1
    Almost good, only two commas too much

    select col1 ||','|| col2||','|| col3 ||','
    from table1
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

  3. #3
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Hi Jurij
    This does solve the problem but the output is one vry long field which looks messy.

    I want the different fields to look like neat columns.

    your example will return output like this

    col1 ||','|| col2||','|| col3 ||','
    -----------------------------------
    asdasdasd, asdsdasdasd, asdasdad,
    ssdsd,sddsdsd,sdsddsd,
    fgfg,gfgfg,fgfg,

    I want the space between each column to be padded to column length.

    Thanks

    Suresh

    Once you have eliminated all of the impossible,
    whatever remains however improbable,
    must be true.

  4. #4
    Join Date
    Apr 2001
    Location
    London
    Posts
    725
    Hi Jurij

    Thanks for your reply, that will be fine.

    I comma delimitted in Excel and looks fine.

    Suresh
    Once you have eliminated all of the impossible,
    whatever remains however improbable,
    must be true.

Posting Permissions

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


Click Here to Expand Forum to Full Width