Function

  • Hi to all;

    To pass the Dynamic numbers,

    The table is Master like an following format

    Id Name

    1 col1,col2col3

    2 col1,

    3 col1,col2

    4 col1,col2,col3

    5 col1,col2col3

    6 col1

    SELECT distinct Col1,Col2,Col3,dbo.List(@col,@Id) [lst] From Master

    i need the following output

    Col1 col2 Col3 lst

    1 name bm col1,col2col3

    2 Age Dm Col2,col3

    How to i pass the morethan one values in function ,

    Please any one help me ..

    This is a function

    ALTER function DegreeList(@col as char(8000),@Id AS CHAR(12))

    returns varchar(8000)

    as

    begin

    declare @res as varchar(8000)

    set @res =''

    SELECT @res = @res+rtrim(col )+'/'+SPACE(2) from tbl

    where col1=@Id

    if(len(@res)>1)

    set @res= substring(@res, 1, len(@res)-1)

    else

    set @res='-'

    return @res

    end

    Thanks

    Rahuman.A

  • Do you require help for "SQL Server 2005 Integration Services" ?

    If you are finding solution for T-SQL (means query related) then post the question in TSQL forums.

    Thanks

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply