Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2005
    Posts
    21

    Unanswered: Creating one string from multi records

    Hello,

    My problem is that i have a table in my DB that is used for multi list boxs which is linked to a header record.
    so 1 header record can have none, 1 or many entries in this table.

    So, is there a way in a query to concatinate however many entries in the table into 1 record seperated by a ; that i can link to my header record.

    thanks
    Ian.

  2. #2
    Join Date
    Dec 2008
    Posts
    135
    select stuff((select ';'+columnname from tablename where headerid = t.headerid for xml path('')),1,1,'') from tablename t

  3. #3
    Join Date
    Sep 2005
    Posts
    21
    Excellent, cheers......

    didnt even know this function existed...

    sorted now...

  4. #4
    Join Date
    Dec 2008
    Posts
    135
    Thanks,

    xml path function will works from 2005 and above .

Posting Permissions

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