Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    2

    Unanswered: Select a column into one field

    I need to select a column of values into one field. I can get it to work in SQL Server with the following script, but not Sybase 9.0. Can anyone help?

    ---- SQL SERVER SCRIPT -----
    Code:
    DECLARE @List varchar(1000)
    
    SELECT @List = COALESCE(@List + ', ', '') +
    CAST(fruitname AS varchar(20))
    FROM fruit_table
    
    SELECT @List as 'Fruit'
    
    
    Fruit
    --------
    Apples, Oranges, Bananas
    ---------------------------

  2. #2
    Join Date
    Jun 2004
    Location
    Paris, France
    Posts
    43
    with sybase, you can't do it without a loop (cursor or while),
    for it's forbidden to select a resultset which has more than 1 row into a variable.

Posting Permissions

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