标签:declare create var ret 出现 charindex index turn sel
create function AccRepeat(@str varchar(50),@sub varchar(50)) returns int as begin declare @pos int,@n int select @n=0, @pos=charindex(@sub,@str) while(@pos<>0) begin select @str=right(@str,len(@str)-@pos),@pos=charindex(@sub,@str),@n=@n+1 end return(@n) end go select dbo.AccRepeat(‘MicrosoftSQLServer‘,‘s‘) ------ 3
标签:declare create var ret 出现 charindex index turn sel
原文地址:https://www.cnblogs.com/salv/p/11355722.html