Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401

    Unanswered: T-SQL Query ????

    how do i do this
    -----------------------------------------------------
    ID
    ---------
    10
    20
    30
    40


    Data needed like

    10,20,30,40
    -----------------------------------------------------
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    declare @IDtable table (IDvalue int)

    insert into @IDtable values (10)
    insert into @IDtable values (20)
    insert into @IDtable values (30)
    insert into @IDtable values (40)

    declare @IDstring varchar(50)

    set @IDstring = ''

    select @IDstring = @IDstring + cast(IDvalue as varchar(4)) + ',' from @IDtable

    set @IDstring = left(@IDstring, len(@IDstring)-1)

    print @IDstring
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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