How to split a string in Sql Server

DECLARE @Pos INT 
DECLARE @NextPos INT 
DECLARE @String VARCHAR(50) 
DECLARE @Delimiter VARCHAR(50) 

SET @String ='C-sharp,corner,.com' 
SET @Delimiter = ',' 
SET @String = @String + @Delimiter 
SET @Pos = charindex(@Delimiter,@String) 

WHILE (@pos <> 0) 
BEGIN 
SELECT	substring(@String,1,@Pos - 1) 
SET @String = substring(@String,@pos+1,len(@String)) 
SET @pos = charindex(@Delimiter,@String) 
END