select @datastring2 = @datastring2 + substring(@datastring,N,1)from Tallywhere n <=len(@datastring) and substring(@datastring,N,1) <> ','
DECLARE @Demo INT = 0SELECT @Demo = @Demo + N FROM Tally WHERE N <= 10 SELECT @Demo