Late entry to the discussion. I ran into an issue with a similar string splitter, and tried to break down my findings on this.
The following code causes an error in SQL Server 2008R2:
DECLARE @VALUES VARCHAR(8000)
SET @VALUES = 'E62|E48|E47'
SELECT
Item
FROM dbo.[DelimitedSplit8K](@VALUES, '|')
WHERE ISNUMERIC(RIGHT(Item, LEN(Item) - 1)) > 0
The following works
DECLARE @VALUES VARCHAR(MAX)
SET @VALUES = 'E62|E48|E47'
SELECT
Item, ItemNumber
FROM dbo.[DelimitedSplit8K](@VALUES, '|')
WHERE ISNUMERIC(RIGHT(Item, LEN(Item) - 1)) > 0
Select * also works, as does only ItemNumber.
The odd thing is that none of the possible result sets give an Item with a length of 0 (that would result in the error). I think something gets optimized so that an error is prematurely raised.
If I add one more CTE level to the end of the splitter function, specifying that ItemNumber > 0, this error does not occur.