• Dirk vd Watt (12/28/2012)


    Hi,

    Can you please test your new functions' performance against the following function :

    CREATE FUNCTION [dbo].[ParseString]

    (

    @String VarChar(8000),

    @Delimiter VarChar(1)

    ) RETURNS TABLE

    AS

    RETURN

    (

    WITH Tokens(LinePos, StartPos, EndPos) AS

    (

    SELECT

    1,

    1,

    CharIndex(@Delimiter, @String)

    UNION ALL

    SELECT

    LinePos + 1,

    EndPos + 1,

    CharIndex(@Delimiter, @String, EndPos + 1)

    FROM

    Tokens

    WHERE

    EndPos > 0

    )

    SELECT

    CONVERT(Int, LinePos) AS RowNumber,

    SubString

    (

    @String,

    StartPos,

    CASE

    WHEN EndPos > 0 THEN (EndPos - StartPos)

    ELSE 8000

    END

    )

    AS StringValue

    from Tokens

    )

    and let us know which performs best ?

    Regards,

    Dirk van der Watt

    Don't really need to, this is a recursive cte type splitter. Pretty confident that the DelimitSplit8K will out perform it.