Results 1 to 3 of 3

Thread: Combining records

  1. #1
    Join Date
    Aug 2007
    Posts
    4

    Combining records

    Hi,
    Can anybody please tell how can I combing all records in field into one field.
    For example

    If my table is like

    Final
    _______
    aaa
    bbb
    ccc
    ddd


    and i want result as

    final1
    _____
    aaabbbcccddd


    I do not want to use cursors for this. Please let me know if somebody knows the answer

    Thanks

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    If total string length is less than 8000 characters then you can do

    declare @result varchar(8000)

    set @result=''

    select @result=@result+final
    from mytable

    print @result

  3. #3
    Join Date
    Aug 2007
    Posts
    4
    Thanks for your help.

Posting Permissions

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