how to make inline function in following situation.

  • hi,

    ALTER FUNCTION udfa(@aa int)

    RETURNS @tbla table (a VARCHAR(MAX),b VARCHAR(MAX))

    AS

    BEGIN

    Declare @a varchar(max),@b varchar(max)

    SELECT @a=isnull(@a)+L,@b=isnull(@b)+B from xyz where id=@aa

    insert into @tbla(a,b) select @a,@b

    RETURN

    END

    col L and B of table xyz is alphabets only so sum can not be used

    q1) I want to make inline function , so pls tel me is there any other way to formulat it?

    yours sincerley

  • What is this supposed to be doing?

    You want this changing to an in-line table-valued function?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • it will bring all the values of a col in a variable comma seprated, this is what i want.

    so there will be one row two cols with comma seprated values of all rows.

    yours sincerley

  • In that case you don't need a function, look up FOR XML PATH and read up on how to use it for string concatenation.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 4 posts - 1 through 3 (of 3 total)

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