select case when substring(@s,a.id,1)=',' then 1 else 0 end
from (select 1 as id union all
      select 2 as id union all
      select 3 as id union all
      ...
      select 100 as id ) a
where a.id<=len(@s)