• Actually, you did not include the function body. You would need to add the following for it to work:

    RETURNS @tblArray TABLE

    (

    ElementIDsmallintIDENTITY(1,1), --Array index

    Elementvarchar(1000)--Array element contents

    )

    AS

    BEGIN

    DECLARE

    @siIndexsmallint,

    @siStartsmallint,

    @siDelSizesmallint

    SET @siDelSize= LEN(@vcDelimiter)

    --loop through source string and add elements to destination table array

    WHILE LEN(@vcDelimitedString) > 0

    BEGIN

    SET @siIndex = CHARINDEX(@vcDelimiter, @vcDelimitedString)

    IF @siIndex = 0

    BEGIN

    INSERT INTO @tblArray VALUES(@vcDelimitedString)

    BREAK

    END

    ELSE

    BEGIN

    INSERT INTO @tblArray VALUES(SUBSTRING(@vcDelimitedString, 1,@siIndex - 1))

    SET @siStart = @siIndex + @siDelSize

    SET @vcDelimitedString = SUBSTRING(@vcDelimitedString, @siStart , LEN(@vcDelimitedString) - @siStart + 1)

    END

    END

    RETURN

    END

    GO


    Karen Gayda
    MCP, MCSD, MCDBA

    gaydaware.com