• In general, functions in SQL Server are a feature worth avoiding.

    http://beyondrelational.com/quiz/sqlserver/tsql/2011/questions/Are-all-Scalar-User-Defined-Functions-UDF-always-bad.aspx?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+sqlquiz+%28SQL+Server+Quiz%29.

    The functions you suggest are probably the "best" or maybe "least-worst", in that they are scalar functions that access no database tables. They do require a small overhead over writing out the function inline, but on the other hand, they promote code-reuse and make the code easier to read.

    However, the contents of your function

    BEGIN

    ????-- If the delimiter passed was null, use an empty string.

    ????set @Delim = IsNull(@Delim, '')

    ????-- If the list is empty, set it equal to the value that was passed in.

    ????if (@ValueList IS NULL)

    ????begin

    ????????set @ValueList = @Item

    ????end

    ????-- If the item passed in was not null, append it to the list.

    ????else if (@Item IS NOT NULL)

    ????begin

    ????????set @ValueList = @Item + @Delim + @ValueList

    ????end

    ????RETURN @ValueList

    END

    can be re-written as

    select @Item + ISNULL(IsNull(@Delim,'') + @ValueList,'')

    and for a simple piece of code like this, I would prefer to write out inline and avoid the overhead of calling a function.