create function [dbo].[f_split_count](@c varchar(MAX),@split varchar(1))
returns int
as
begin
declare @cnt int
set @cnt= 0
set @c = Rtrim(Ltrim(@c))
while(charindex(@split,@c)<>0)
begin
if charindex(@split,@c)>1
set @cnt= @cnt+1
set @c = Rtrim(Ltrim(stuff(@c,1,charindex(@split,@c),'')))
end
if Len(@c)>1
set @cnt= @cnt+1
return @cnt
end
returns int
as
begin
declare @cnt int
set @cnt= 0
set @c = Rtrim(Ltrim(@c))
while(charindex(@split,@c)<>0)
begin
if charindex(@split,@c)>1
set @cnt= @cnt+1
set @c = Rtrim(Ltrim(stuff(@c,1,charindex(@split,@c),'')))
end
if Len(@c)>1
set @cnt= @cnt+1
return @cnt
end