This is MS SQL Server 2008 adopted Split function (UDF)
Source: Best Split UDF function with delimeter in T-SQL to return result as a table
CREATE Function [dbo].[fnStringSplitter]
(
@IDs Varchar(max)
,@Delimiter Varchar(1)
)
Returns @Tbl_IDs Table (ID Varchar(500)) As
Begin
Set @IDs = @IDs + @Delimiter
Declare @Pos1 Int
Declare @pos2 Int
Declare @RowNum Int
Set @Pos1 = CharIndex(@Delimiter,@IDs,1)
Set @Pos2=1
While @Pos1 > 0
Begin
Insert @Tbl_IDs Values (Substring(@IDs,@Pos2,@Pos1-@Pos2))
Set @Pos2=@Pos1+1
Set @Pos1 = CharIndex(@Delimiter,@IDs,@Pos1+1)
End
Return
End
Test
SELECT * from dbo.fnStringSplitter(',,1,2,3,4,5,6,7,8,9,10', ',')