DECLARE @string_to_trim varchar(60),@i INT,@cont INT,@len int
SET @string_to_trim = 'Ft,st,d,rt,ds,43,io,er,lpu'
set @cont=0
SET @len =0
SELECT @len =len(SUBSTRING(REVERSE(@string_to_trim),1,CHARINDEX(',',REVERSE(@string_to_trim))-1))
WHILE(LEN(@string_to_trim)>@len)
BEGIN
select @cont = @cont+1
SELECT @i = CHARINDEX(',', @string_to_trim), @string_to_trim = SUBSTRING(@string_to_trim,@i+1,LEN(@string_to_trim))
END
SELECT @cont+1
GO