• ALTER FUNCTION [dbo].[SplitString]

    (

    @String VARCHAR(MAX),

    @Delimeter Char(1)

    )

    RETURNS @RtnValue TABLE

    (

    Value VARCHAR(100)

    )

    AS

    BEGIN

    DECLARE @Cnt INT

    SET @Cnt = 1

    WHILE (CHARINDEX(@Delimeter, @String) > 0)

    BEGIN

    INSERT INTO @RtnValue (Value)

    SELECT

    Data = ltrim(rtrim(Substring(@String,1,Charindex(@Delimeter,@String)-1)))

    SET @String = Substring(@String,Charindex(@Delimeter,@String)+1,len(@String))

    SET @Cnt = @Cnt + 1

    END

    INSERT INTO @RtnValue (Value)

    SELECT Data = ltrim(rtrim(@String))

    RETURN

    END

    I'm aware this is RBAR and i'm aware of tally techinics but the strings that this functions breaks are usually of something about 200 characters? but mostly it comes as a null, can that make enourmous IO counts?