Try this - it works faster for me than using a tally table - it converts the string to xml, then selects from the XML
CREATE FUNCTION [dbo].[Split]
(
@delimited nvarchar(max),
@delimiter nvarchar(100)
) RETURNS @t TABLE
(
val nvarchar(max)
)
AS
BEGIN
declare @xml xml
set @xml = N'<root><r>' + replace(@delimited,@delimiter,'</r><r>') + '</r></root>'
insert into @t(val)
select
r.value('.','nvarchar(max)') as item
from @xml.nodes('//root/r') as records(r)
RETURN
END