query to find a sum of char values present in different rows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Anu139
    New Member
    • Nov 2006
    • 8

    query to find a sum of char values present in different rows

    the table is
    col1
    ---------
    M
    S
    S
    Q
    L

    The expected Result is

    Name
    -----------
    MSSQL

    I need a single query which solves the above problem. please help me out?
  • Anu139
    New Member
    • Nov 2006
    • 8

    #2
    Originally posted by Anu139
    the table is
    col1
    ---------
    M
    S
    S
    Q
    L

    The expected Result is

    Name
    -----------
    MSSQL

    I need a single query which solves the above problem. please help me out?
    I got the answer

    declare @name varchar(50)

    select @name = coalesce( @name,'' )+ col1 from tab_name

    select @name 'Name'

    Comment

    Working...