You must Sign In to post a response.
  • Category: SQL Server

    Column Values with Comma Separated

    Need integer column values, separated by comma..

    SUPPOSE Table name is Temp
    tempid statecode Active
    1 4 1
    2 5 1
    3 8 1
    4 7 0


    need output as :
    Statecode
    4,5,8
  • #769494
    You can use Concatenate option in SQL. Like below

    Example 1:
    select concat(concat(CampusId, ','),campusname) as aa from OrgCampus

    Example 2: I hope, this will work for you.

    select campusname +', '+ campusname +', '+campusname as aa from OrgCampus

    -----------------------------------------------------------------------------
    Regards,
    Gopi A.
    +91 9894315571
    Skype:gopi.net
    http://asaigopi-dotnet.blogspot.in/


  • Sign In to post your comments